Documentation ¶
Index ¶
- Constants
- func GenerateOutPoint(txHash string, index uint32) (*wire.OutPoint, error)
- func GetClient() redis.Cmdable
- func GetFileContent(url string) ([]byte, error)
- func GetPrivateKey(privateHex string) (*btcec.PrivateKey, *btcec.PublicKey, error)
- func GetPublicAddress(publicKey *btcec.PublicKey, cfg *chaincfg.Params) (btcutil.Address, error)
- func GetTxHex(tx *wire.MsgTx) (string, error)
- func GetTxOut(svc *ServiceContext, outpoint *wire.OutPoint) (int64, error)
- func InitRedis(cnf *Config) error
- func Server(grpcFn GrpcGreeterRegisterFn, gatewayFn GrpcGatewayRegisterFn, ...)
- func ValidateReceiptUTXO(svc *ServiceContext, outPoint *wire.OutPoint, estimatedFeeRate int64) error
- func WaitQuitSignal(svc *ServiceContext)
- type Config
- type GrpcGatewayRegisterFn
- type GrpcGreeterRegisterFn
- type HDWallet
- type Manager
- type ServiceContext
- type Validator
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 GetFileContent ¶
func GetPrivateKey ¶
func GetPublicAddress ¶
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"` }
type GrpcGatewayRegisterFn ¶
type GrpcGreeterRegisterFn ¶
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)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.