types

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerContextKey        = serverContext("server.context")
	DBContextKey            = serverContext("db.context")
	ListenAddressContextKey = serverContext("listenaddress.context")
	HTTPConfigContextKey    = serverContext("http.context")
)

ServerContextKey defines the context key used to retrieve a server.Context from a command's Context.

Variables

This section is empty.

Functions

This section is empty.

Types

type BITCOINBridge

type BITCOINBridge interface {
	// Deposit transfers amout to address
	Deposit(string, BitcoinFrom, int64, *types.Transaction, uint64, bool) (*types.Transaction, []byte, string, string, error)
	// Transfer amount to address
	Transfer(BitcoinFrom, int64, *types.Transaction, uint64, bool) (*types.Transaction, string, error)
	// WaitMined wait mined
	WaitMined(context.Context, *types.Transaction, []byte) (*types.Receipt, error)
	// TransactionReceipt
	TransactionReceipt(hash string) (*types.Receipt, error)
	// TransactionByHash
	TransactionByHash(hash string) (*types.Transaction, bool, error)
	//  EnableEoaTransfer
	EnableEoaTransfer() bool
	FromAddress() string
}

BITCOINBridge defines the interface of custom bitcoin bridge.

type BITCOINTxIndexer

type BITCOINTxIndexer interface {
	// ParseBlock parse bitcoin block tx
	ParseBlock(int64, int64) ([]*BitcoinTxParseResult, *wire.BlockHeader, error)
	// LatestBlock get latest block height in the longest block chain.
	LatestBlock() (int64, error)
	// CheckConfirmations get tx detail info
	CheckConfirmations(txHash string) error
}

BITCOINTxIndexer defines the interface of custom bitcoin tx indexer.

type BitcoinFrom

type BitcoinFrom struct {
	Address string
}

type BitcoinTo

type BitcoinTo struct {
	Address string
	Value   int64
}

type BitcoinTxParseResult

type BitcoinTxParseResult struct {
	// from is l2 user address, by parse bitcoin get the address
	From []BitcoinFrom
	// to is listening address
	To string
	// value is from transfer amount
	Value int64
	// tx_id is the btc transaction id
	TxID string
	// tx_type is the type of the transaction, eg. "brc20_transfer","transfer"
	TxType string
	// index is the index of the transaction in the block
	Index int64
	// tos tx all to info
	Tos []BitcoinTo
}

Jump to

Keyboard shortcuts

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