bch

package
v0.0.0-...-0928cd4 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: GPL-3.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const EGTXFlag = "6a0445475458" //op_return(6a) + len(04) + EGTX(45475458)

Variables

This section is empty.

Functions

func BuildLogData

func BuildLogData(confirmations *uint256.Int,
	outputInfoArray, inputInfoArray [][32]byte,
	outputTokenInfos, inputTokenInfos []TokenInfo,
	otherDataInOpReturn [][]byte,
) []byte

func ExtractEGTXNullData

func ExtractEGTXNullData(nullDataHexStr string) (contractAddress [20]byte, topics [][32]byte, otherData [][]byte, err error)

func ExtractNullData

func ExtractNullData(nullDataHexStr string) (otherData [][]byte, err error)

func ExtractSenderInfo

func ExtractSenderInfo(originTx *btcjson.TxRawResult, vout uint32, params *chaincfg.Params) (senderInfo [32]byte, err error)

func MakeMainChainClient

func MakeMainChainClient(mainChainClientInfo string) (*rpcclient.ConnConfig, *rpcclient.Client)

func MustParseABI

func MustParseABI(abiString string) *abi.ABI

func PackEGTXLogDataEvent

func PackEGTXLogDataEvent(confirmations *big.Int, outputs, inputs []*big.Int, outputTokenInfos, inputTokenInfos []TokenInfo, otherData [][]byte) []byte

func ParseEGTXNullData

func ParseEGTXNullData(script string) (contractAddress [20]byte, topics [][32]byte, otherData [][]byte, err error)

func UnPackEGTXLog

func UnPackEGTXLog(data []byte) ([]interface{}, error)

Types

type IBchClient

type IBchClient interface {
	GetRawMempool() ([]*chainhash.Hash, error)
	GetRawTransactionVerbose(txHash *chainhash.Hash) (*btcjson.TxRawResult, error)
	GetTransaction(txHash *chainhash.Hash) (*btcjson.GetTransactionResult, error)
	GetBlockCount() (int64, error)
	GetBlockHash(blockHeight int64) (*chainhash.Hash, error)
	GetBlockVerboseTx(blockHash *chainhash.Hash) (*btcjson.GetBlockVerboseTxResult, error)
	TestMempoolAccept(rawTx []byte) (bool, error)
	SendRawTransaction(rawTx []byte) (*chainhash.Hash, error)
	GetTxOut(txHash *chainhash.Hash, index uint32, mempool bool) (*btcjson.GetTxOutResult, error)
}

type JsonRpcError

type JsonRpcError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type JsonRpcResult

type JsonRpcResult struct {
	Id     string          `json:"id"`
	Error  *JsonRpcError   `json:"error"`
	Result json.RawMessage `json:"result"`
}

type MockClient

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

func (*MockClient) AddTx

func (m *MockClient) AddTx(txHash *chainhash.Hash, tx *btcjson.TxRawResult)

func (*MockClient) AddTxOut

func (m *MockClient) AddTxOut(txHash *chainhash.Hash, index uint32, result *btcjson.GetTxOutResult)

func (*MockClient) AddTxToAccept

func (m *MockClient) AddTxToAccept(rawTx string)

func (*MockClient) AddTxToSend

func (m *MockClient) AddTxToSend(rawTx string, txHash *chainhash.Hash)

func (*MockClient) GetBlockCount

func (m *MockClient) GetBlockCount() (int64, error)

func (*MockClient) GetBlockHash

func (m *MockClient) GetBlockHash(blockHeight int64) (*chainhash.Hash, error)

func (*MockClient) GetBlockVerboseTx

func (m *MockClient) GetBlockVerboseTx(blockHash *chainhash.Hash) (*btcjson.GetBlockVerboseTxResult, error)

func (*MockClient) GetRawMempool

func (m *MockClient) GetRawMempool() ([]*chainhash.Hash, error)

func (*MockClient) GetRawTransactionVerbose

func (m *MockClient) GetRawTransactionVerbose(txHash *chainhash.Hash) (*btcjson.TxRawResult, error)

func (*MockClient) GetTransaction

func (m *MockClient) GetTransaction(txHash *chainhash.Hash) (*btcjson.GetTransactionResult, error)

func (*MockClient) GetTxOut

func (m *MockClient) GetTxOut(txHash *chainhash.Hash, index uint32, mempool bool) (*btcjson.GetTxOutResult, error)

func (*MockClient) SendRawTransaction

func (m *MockClient) SendRawTransaction(rawTx []byte) (*chainhash.Hash, error)

func (*MockClient) TestMempoolAccept

func (m *MockClient) TestMempoolAccept(rawTx []byte) (bool, error)

type RetryableClient

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

func NewRetryableClient

func NewRetryableClient(mainChainClientInfo string, delayTime int64, maxRetry int, logger log.Logger) *RetryableClient

func (*RetryableClient) Delay

func (r *RetryableClient) Delay()

func (*RetryableClient) GetBlockCount

func (r *RetryableClient) GetBlockCount() (c int64, err error)

func (*RetryableClient) GetBlockHash

func (r *RetryableClient) GetBlockHash(blockHeight int64) (hash *chainhash.Hash, err error)

func (*RetryableClient) GetBlockVerboseTx

func (r *RetryableClient) GetBlockVerboseTx(blockHash *chainhash.Hash) (res *btcjson.GetBlockVerboseTxResult, err error)

func (*RetryableClient) GetRawMempool

func (r *RetryableClient) GetRawMempool() (hashes []*chainhash.Hash, err error)

func (*RetryableClient) GetRawTransactionVerbose

func (r *RetryableClient) GetRawTransactionVerbose(txHash *chainhash.Hash) (res *btcjson.TxRawResult, err error)

func (*RetryableClient) GetTransaction

func (r *RetryableClient) GetTransaction(txHash *chainhash.Hash) (res *btcjson.GetTransactionResult, err error)

func (*RetryableClient) GetTxOut

func (r *RetryableClient) GetTxOut(txHash *chainhash.Hash, index uint32, mempool bool) (txOut *btcjson.GetTxOutResult, err error)

func (*RetryableClient) SendRawTransaction

func (r *RetryableClient) SendRawTransaction(rawTx []byte) (txHash *chainhash.Hash, err error)

func (*RetryableClient) TestMempoolAccept

func (r *RetryableClient) TestMempoolAccept(rawTx []byte) (ok bool, err error)

type TestMempoolAcceptResult

type TestMempoolAcceptResult struct {
	Txid         string `json:"txid"`
	Allowed      bool   `json:"allowed"`
	RejectReason string `json:"reject-reason"`
}

https://docs.bitcoincashnode.org/doc/json-rpc/testmempoolaccept/

type TokenInfo

type TokenInfo struct {
	AddressAndTokenAmount      *big.Int "json:\"addressAndTokenAmount\""
	TokenCategory              *big.Int "json:\"tokenCategory\""
	NftCommitmentLengthAndHead *big.Int "json:\"nftCommitmentLengthAndHead\""
	NftCommitmentTail          *big.Int "json:\"nftCommitmentTail\""
}

Jump to

Keyboard shortcuts

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