Documentation ¶
Index ¶
- Constants
- func AuthoredTxToString(authtx interface{}, pretty bool) string
- func GetP2shAddressWithMemo(memo, pubKeyHash []byte, net *chaincfg.Params) (p2shAddress string, redeemScript []byte, err error)
- func MarshalToJSON(obj interface{}, pretty bool) string
- func NewUnsignedTransaction(outputs []*wire.TxOut, relayFeePerKb btcutil.Amount, ...) (*txauthor.AuthoredTx, error)
- type Bridge
- func (b *Bridge) AggregateUtxos(addrs []string, utxos []*electrs.ElectUtxo) (string, error)
- func (b *Bridge) BuildAggregateTransaction(addrs []string, utxos []*electrs.ElectUtxo) (rawTx *txauthor.AuthoredTx, err error)
- func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
- func (b *Bridge) DcrmSignMsgHash(msgHash []string, args *tokens.BuildTxArgs) (rsv []string, err error)
- func (b *Bridge) DcrmSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signedTx interface{}, txHash string, err error)
- func (b *Bridge) FindUtxos(addr string) ([]*electrs.ElectUtxo, error)
- func (b *Bridge) GetBlockHash(height uint64) (string, error)
- func (b *Bridge) GetBlockTxids(blockHash string) ([]string, error)
- func (b *Bridge) GetChainConfig() *chaincfg.Params
- func (b *Bridge) GetElectTransactionStatus(txHash string) (*electrs.ElectTxStatus, error)
- func (b *Bridge) GetLatestBlockNumber() (uint64, error)
- func (b *Bridge) GetOutspend(txHash string, vout uint32) (*electrs.ElectOutspend, error)
- func (b *Bridge) GetP2shAddress(bindAddr string) (p2shAddress string, redeemScript []byte, err error)
- func (b *Bridge) GetP2shAddressByRedeemScript(redeemScript []byte) (string, error)
- func (b *Bridge) GetP2shSigScript(redeemScript []byte) ([]byte, error)
- func (b *Bridge) GetPoolTransactions(addr string) ([]*electrs.ElectTx, error)
- func (b *Bridge) GetPoolTxidList() ([]string, error)
- func (b *Bridge) GetTransaction(txHash string) (interface{}, error)
- func (b *Bridge) GetTransactionByHash(txHash string) (*electrs.ElectTx, error)
- func (b *Bridge) GetTransactionHistory(addr, lastSeenTxid string) ([]*electrs.ElectTx, error)
- func (b *Bridge) GetTransactionStatus(txHash string) *tokens.TxStatus
- func (b *Bridge) IsP2pkhAddress(addr string) bool
- func (b *Bridge) IsP2shAddress(addr string) bool
- func (b *Bridge) IsValidAddress(addr string) bool
- func (b *Bridge) MakeSignedTransaction(authoredTx *txauthor.AuthoredTx, msgHash, rsv []string, sigScripts [][]byte, ...) (signedTx interface{}, txHash string, err error)
- func (b *Bridge) PostTransaction(txHex string) (txHash string, err error)
- func (b *Bridge) SendTransaction(signedTx interface{}) (txHash string, err error)
- func (b *Bridge) SetTokenAndGateway(tokenCfg *tokens.TokenConfig, gatewayCfg *tokens.GatewayConfig)
- func (b *Bridge) SignTransaction(rawTx interface{}, wif string) (signedTx interface{}, txHash string, err error)
- func (b *Bridge) StartChainTransactionScanJob()
- func (b *Bridge) StartPoolTransactionScanJob()
- func (b *Bridge) StartSwapHistoryScanJob()
- func (b *Bridge) VerifyAggregateMsgHash(msgHash []string, args *tokens.BuildTxArgs) error
- func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHash []string, extra interface{}) (err error)
- func (b *Bridge) VerifyP2shTransaction(txHash, bindAddress string, allowUnstable bool) (*tokens.TxSwapInfo, error)
- func (b *Bridge) VerifyTransaction(txHash string, allowUnstable bool) (*tokens.TxSwapInfo, error)
- type EncAuthoredTx
- type EncMsgTx
- type EncOutPoint
- type EncTxIn
- type EncTxOut
Constants ¶
const (
// AggregateIdentifier used in accepting
AggregateIdentifier = "aggregate"
)
Variables ¶
This section is empty.
Functions ¶
func AuthoredTxToString ¶
AuthoredTxToString AuthoredTx to string
func GetP2shAddressWithMemo ¶
func GetP2shAddressWithMemo(memo, pubKeyHash []byte, net *chaincfg.Params) (p2shAddress string, redeemScript []byte, err error)
GetP2shAddressWithMemo common
func MarshalToJSON ¶
MarshalToJSON marshal to json
func NewUnsignedTransaction ¶
func NewUnsignedTransaction(outputs []*wire.TxOut, relayFeePerKb btcutil.Amount, fetchInputs txauthor.InputSource, fetchChange txauthor.ChangeSource) (*txauthor.AuthoredTx, error)
NewUnsignedTransaction ref btcwallet ref. https://github.com/btcsuite/btcwallet/blob/b07494fc2d662fdda2b8a9db2a3eacde3e1ef347/wallet/txauthor/author.go we only modify it to support P2PKH change script (the origin only support P2WPKH change script)
Types ¶
type Bridge ¶
type Bridge struct {
*tokens.CrossChainBridgeBase
}
Bridge btc bridge
var BridgeInstance *Bridge
BridgeInstance btc bridge instance
func NewCrossChainBridge ¶
NewCrossChainBridge new btc bridge
func (*Bridge) AggregateUtxos ¶
AggregateUtxos aggregate uxtos
func (*Bridge) BuildAggregateTransaction ¶
func (b *Bridge) BuildAggregateTransaction(addrs []string, utxos []*electrs.ElectUtxo) (rawTx *txauthor.AuthoredTx, err error)
BuildAggregateTransaction build aggregate tx (spend p2sh utxo)
func (*Bridge) BuildRawTransaction ¶
func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
BuildRawTransaction build raw tx
func (*Bridge) DcrmSignMsgHash ¶
func (b *Bridge) DcrmSignMsgHash(msgHash []string, args *tokens.BuildTxArgs) (rsv []string, err error)
DcrmSignMsgHash dcrm sign msg hash
func (*Bridge) DcrmSignTransaction ¶
func (b *Bridge) DcrmSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signedTx interface{}, txHash string, err error)
DcrmSignTransaction dcrm sign raw tx
func (*Bridge) GetBlockHash ¶
GetBlockHash impl
func (*Bridge) GetBlockTxids ¶
GetBlockTxids impl
func (*Bridge) GetChainConfig ¶
GetChainConfig get chain config (net params)
func (*Bridge) GetElectTransactionStatus ¶
func (b *Bridge) GetElectTransactionStatus(txHash string) (*electrs.ElectTxStatus, error)
GetElectTransactionStatus impl
func (*Bridge) GetLatestBlockNumber ¶
GetLatestBlockNumber impl
func (*Bridge) GetOutspend ¶
GetOutspend impl
func (*Bridge) GetP2shAddress ¶
func (b *Bridge) GetP2shAddress(bindAddr string) (p2shAddress string, redeemScript []byte, err error)
GetP2shAddress get p2sh address from bind address
func (*Bridge) GetP2shAddressByRedeemScript ¶
GetP2shAddressByRedeemScript get p2sh address by redeem script
func (*Bridge) GetP2shSigScript ¶
GetP2shSigScript get p2sh signature script
func (*Bridge) GetPoolTransactions ¶
GetPoolTransactions impl
func (*Bridge) GetPoolTxidList ¶
GetPoolTxidList impl
func (*Bridge) GetTransaction ¶
GetTransaction impl
func (*Bridge) GetTransactionByHash ¶
GetTransactionByHash impl
func (*Bridge) GetTransactionHistory ¶
GetTransactionHistory impl
func (*Bridge) GetTransactionStatus ¶
GetTransactionStatus impl
func (*Bridge) IsP2pkhAddress ¶
IsP2pkhAddress check p2pkh addrss
func (*Bridge) IsP2shAddress ¶
IsP2shAddress check p2sh addrss
func (*Bridge) IsValidAddress ¶
IsValidAddress check address
func (*Bridge) MakeSignedTransaction ¶
func (b *Bridge) MakeSignedTransaction(authoredTx *txauthor.AuthoredTx, msgHash, rsv []string, sigScripts [][]byte, args *tokens.BuildTxArgs) (signedTx interface{}, txHash string, err error)
MakeSignedTransaction make signed tx
func (*Bridge) PostTransaction ¶
PostTransaction impl
func (*Bridge) SendTransaction ¶
SendTransaction send signed tx
func (*Bridge) SetTokenAndGateway ¶
func (b *Bridge) SetTokenAndGateway(tokenCfg *tokens.TokenConfig, gatewayCfg *tokens.GatewayConfig)
SetTokenAndGateway set token and gateway config
func (*Bridge) SignTransaction ¶
func (b *Bridge) SignTransaction(rawTx interface{}, wif string) (signedTx interface{}, txHash string, err error)
SignTransaction sign tx with wif
func (*Bridge) StartChainTransactionScanJob ¶
func (b *Bridge) StartChainTransactionScanJob()
StartChainTransactionScanJob scan job
func (*Bridge) StartPoolTransactionScanJob ¶
func (b *Bridge) StartPoolTransactionScanJob()
StartPoolTransactionScanJob scan job
func (*Bridge) StartSwapHistoryScanJob ¶
func (b *Bridge) StartSwapHistoryScanJob()
StartSwapHistoryScanJob scan job
func (*Bridge) VerifyAggregateMsgHash ¶
func (b *Bridge) VerifyAggregateMsgHash(msgHash []string, args *tokens.BuildTxArgs) error
VerifyAggregateMsgHash verify aggregate msgHash
func (*Bridge) VerifyMsgHash ¶
VerifyMsgHash verify msg hash
func (*Bridge) VerifyP2shTransaction ¶
func (b *Bridge) VerifyP2shTransaction(txHash, bindAddress string, allowUnstable bool) (*tokens.TxSwapInfo, error)
VerifyP2shTransaction verify p2sh tx
func (*Bridge) VerifyTransaction ¶
VerifyTransaction impl
type EncAuthoredTx ¶
EncAuthoredTx stuct
type EncMsgTx ¶
type EncMsgTx struct { Txid string Version int32 TxIn []*EncTxIn TxOut []*EncTxOut LockTime uint32 }
EncMsgTx struct