types

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const FeeRateCacheKey = "btc_fee_rate_estimate"
View Source
const FeeRateCacheKeyTTL = time.Minute * 5
View Source
const OrderNFTDetail = "ORDER_NFT_DETAIL"
View Source
const OrderWalletRedisKey = "ORDER_WALLET_NUMBER"
View Source
const TxSequenceFinal = 0xffffffff

Variables

This section is empty.

Functions

func GenerateOutPoint

func GenerateOutPoint(txHash string, index uint32) (*wire.OutPoint, error)

func GetClient

func GetClient() redis.Cmdable

func GetFileContent

func GetFileContent(url string) ([]byte, error)

func GetPrivateKey

func GetPrivateKey(privateHex string) (*btcec.PrivateKey, *btcec.PublicKey, error)

func GetPublicAddress

func GetPublicAddress(publicKey *btcec.PublicKey, cfg *chaincfg.Params) (btcutil.Address, error)

func GetTxHex

func GetTxHex(tx *wire.MsgTx) (string, error)

func GetTxOut

func GetTxOut(svc *ServiceContext, outpoint *wire.OutPoint) (int64, error)

func InitRedis

func InitRedis(cnf *Config) error

func Server

func Server(grpcFn GrpcGreeterRegisterFn, gatewayFn GrpcGatewayRegisterFn, interceptorFunc ...grpc.UnaryServerInterceptor)

func ValidateReceiptUTXO

func ValidateReceiptUTXO(svc *ServiceContext, outPoint *wire.OutPoint, estimatedFeeRate int64) error

func WaitQuitSignal

func WaitQuitSignal(svc *ServiceContext)

Types

type Config

type Config struct {
	Address               string `env:"ADDRESS"  envDefault:"0.0.0.0" json:"address,omitempty"`
	GrpcPort              int64  `env:"GRPC_PORT"  envDefault:"9000" json:"grpc_port,omitempty"`
	HttpPort              int64  `env:"HTTP_PORT"  envDefault:"80" json:"http_port,omitempty"`
	MySQLDataSource       string `env:"MYSQL_DATA_SOURCE" envDefault:""`
	MySQLMaxIdleConns     int    `env:"MYSQL_MAX_IDLE_CONNS" envDefault:"10"`
	MySQLMaxOpenConns     int    `env:"MYSQL_MAX_OPEN_CONNS" envDefault:"20"`
	MySQLConnMaxLifetime  int    `env:"MYSQL_CONN_MAX_LIFETIME" envDefault:"3600"`
	RedisHost             string `env:"REDIS_HOST" envDefault:"127.0.0.1"`
	RedisPort             string `env:"REDIS_PORT" envDefault:"6379"`
	RedisPassword         string `env:"REDIS_PASSWORD" envDefault:""`
	RedisDB               int    `env:"REDIS_DB" envDefault:"0"`
	TlsInsecureSkip       bool   `env:"TLS_INSECURE_SKIP" envDefault:"false"`
	RedisIsClusterMode    bool   `env:"REDIS_IS_CLUSTER_MODE" envDefault:"false"`
	RedisClusterAddresses string `env:"REDIS_CLUSTER_ADDRESSES" envDefault:""`
	UseCoroutine          bool   `env:"USE_COROUTINE" envDefault:"true"`
	Network               string `env:"NETWORK"  envDefault:"testnet" json:"network,omitempty"`
	RpcHost               string `env:"RPC_HOST"  envDefault:"" json:"rpc_host,omitempty"`
	RpcUser               string `env:"RPC_USER"  envDefault:"" json:"rpc_user,omitempty"`
	RpcPass               string `env:"RPC_PASS"  envDefault:"" json:"rpc_pass,omitempty"`
	MinFeeRate            int64  `env:"MIN_FEE_RATE" envDefault:"1"`
	OrderWalletMnemonic   string `env:"ORDER_WALLET_MNEMONIC"  envDefault:"" json:"order_wallet_mnemonic,omitempty"`
	MempoolAddress        string `env:"MEMPOOL_ADDRESS" envDefault:"https://blockstream.info/testnet/api" json:"mempool_address"`
	UnisatApiKey          string `env:"UNISAT_API_KEY" envDefault:"" json:"unisat_api_key"`
}

func GetConfig

func GetConfig() *Config

type GrpcGatewayRegisterFn

type GrpcGatewayRegisterFn func(ctx context.Context, mux *runtime.ServeMux, endPoint string, option []grpc.DialOption) error

type GrpcGreeterRegisterFn

type GrpcGreeterRegisterFn func(*grpc.Server)

type HDWallet

type HDWallet struct {
	// contains filtered or unexported fields
}

func (HDWallet) Generate

func (hw HDWallet) Generate(n uint32) (string, error)

func (*HDWallet) Init

func (hw *HDWallet) Init(netParams *chaincfg.Params, mnemonic string) error

type Manager

type Manager struct {
	Client redis.Cmdable
	// contains filtered or unexported fields
}
var (
	ManagerClient *Manager
)

type ServiceContext

type ServiceContext struct {
	NetParams    *chaincfg.Params
	Client       *rpcclient.Client
	BtcApiClient *mempool.MempoolClient
	UnisatClient *service.UnisatClient
	Config       *Config
	Wallet       *HDWallet
	Redis        redis.Cmdable
	Db           *gorm.DB
	QuitMutex    *sync.Mutex
}

func GetServiceContext

func GetServiceContext() *ServiceContext

func (*ServiceContext) GetEstimateFeeRate

func (s *ServiceContext) GetEstimateFeeRate() (*mempool.FeeRateEstimate, error)

type Validator

type Validator interface {
	Validate() error
}

Directories

Path Synopsis
go-ord-tx
ord

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL