Versions in this module Expand all Collapse all v0 v0.3.10 Nov 26, 2021 Changes in this version + var PairID = "btc" + func AuthoredTxToString(authtx interface{}, pretty bool) string + func DecodeWIF(wif string) (*btcutil.WIF, error) + func GetBindAddressFromMemoScipt(memoScript string) (bind string, ok bool) + func Init(btcExtra *tokens.BtcExtraConfig) + func MarshalToJSON(obj interface{}, pretty bool) string + type Bridge struct + Inherit Inheritable + func NewCrossChainBridge(isSrc bool) *Bridge + func (b *Bridge) AggregateUtxos(addrs []string, utxos []*electrs.ElectUtxo) (string, error) + func (b *Bridge) BuildAggregateTransaction(relayFeePerKb int64, addrs []string, utxos []*electrs.ElectUtxo) (rawTx *txauthor.AuthoredTx, err error) + func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error) + func (b *Bridge) BuildTransaction(from string, receivers []string, amounts []int64, memo string, ...) (rawTx interface{}, err error) + func (b *Bridge) CalcSignatureHash(sigScript []byte, tx *wire.MsgTx, i int) (sigHash []byte, err error) + func (b *Bridge) CheckSwapinTxType(tx *electrs.ElectTx) (p2shBindAddrs []string, 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) DecodeAddress(addr string) (address btcutil.Address, err error) + func (b *Bridge) EstimateFeePerKb(blocks int) (int64, error) + func (b *Bridge) FindUtxos(addr string) ([]*electrs.ElectUtxo, error) + func (b *Bridge) GetBalance(account string) (*big.Int, error) + func (b *Bridge) GetBlock(blockHash string) (*electrs.ElectBlock, error) + func (b *Bridge) GetBlockHash(height uint64) (string, error) + func (b *Bridge) GetBlockTransactions(blockHash string, startIndex uint32) ([]*electrs.ElectTx, error) + func (b *Bridge) GetBlockTxids(blockHash string) ([]string, error) + func (b *Bridge) GetChainParams() *chaincfg.Params + func (b *Bridge) GetCompressedPublicKey(fromPublicKey string, needVerify bool) (cPkData []byte, err error) + func (b *Bridge) GetElectTransactionStatus(txHash string) (*electrs.ElectTxStatus, error) + func (b *Bridge) GetLatestBlockNumber() (uint64, error) + func (b *Bridge) GetLatestBlockNumberOf(apiAddress string) (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) GetP2shRedeemScript(memo, pubKeyHash []byte) (redeemScript []byte, err error) + func (b *Bridge) GetP2shSigScript(redeemScript []byte) ([]byte, error) + func (b *Bridge) GetPayToAddrScript(address string) ([]byte, error) + func (b *Bridge) GetPoolTransactions(addr string) ([]*electrs.ElectTx, error) + func (b *Bridge) GetPoolTxidList() ([]string, error) + func (b *Bridge) GetPublicKeyFromECDSA(privKey *ecdsa.PrivateKey, compressed bool) []byte + func (b *Bridge) GetReceivedValue(vout []*electrs.ElectTxOut, receiver, pubkeyType string) (value uint64, memoScript string, rightReceiver bool) + func (b *Bridge) GetSigScript(sigScripts [][]byte, prevScript, signData, cPkData []byte, i int) (sigScript []byte, err error) + func (b *Bridge) GetTokenBalance(tokenType, tokenAddress, accountAddress string) (*big.Int, error) + func (b *Bridge) GetTokenSupply(tokenType, tokenAddress string) (*big.Int, 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, error) + func (b *Bridge) InitLatestBlockNumber() + func (b *Bridge) IsP2pkhAddress(addr string) bool + func (b *Bridge) IsP2shAddress(addr string) bool + func (b *Bridge) IsPayToScriptHash(sigScript []byte) 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) NewAddressPubKeyHash(pkData []byte) (*btcutil.AddressPubKeyHash, error) + func (b *Bridge) NewAddressScriptHash(redeemScript []byte) (*btcutil.AddressScriptHash, error) + func (b *Bridge) NewMsgTx(inputs []*wire.TxIn, outputs []*wire.TxOut, locktime uint32) *wire.MsgTx + func (b *Bridge) NewTxIn(txid string, vout uint32, pkScript []byte) (*wire.TxIn, error) + func (b *Bridge) NewTxOut(amount int64, pkScript []byte) *wire.TxOut + func (b *Bridge) NewUnsignedTransaction(outputs []*wireTxOutType, relayFeePerKb btcAmountType, ...) (*txauthor.AuthoredTx, error) + func (b *Bridge) NullDataScript(memo string) ([]byte, error) + func (b *Bridge) ParsePkScript(pkScript []byte) (txscript.PkScript, error) + func (b *Bridge) PostTransaction(txHex string) (txHash string, err error) + func (b *Bridge) SendTransaction(signedTx interface{}) (txHash string, err error) + func (b *Bridge) SerializePublicKey(ecPub *ecdsa.PublicKey, compressed bool) []byte + func (b *Bridge) SerializeSignature(r, s *big.Int) []byte + func (b *Bridge) SetChainAndGateway(chainCfg *tokens.ChainConfig, gatewayCfg *tokens.GatewayConfig) + func (b *Bridge) SetInherit(inherit Inheritable) + func (b *Bridge) ShouldAggregate(aggUtxoCount int, aggSumVal uint64) bool + func (b *Bridge) SignTransaction(rawTx interface{}, pairID string) (signedTx interface{}, txHash string, err error) + func (b *Bridge) SignTransactionWithPrivateKey(rawTx interface{}, privKey *ecdsa.PrivateKey) (signTx interface{}, txHash string, err error) + func (b *Bridge) SignTransactionWithWIF(rawTx interface{}, wif string) (signedTx interface{}, txHash string, err error) + func (b *Bridge) SignWithECDSA(privKey *ecdsa.PrivateKey, msgHash []byte) (rsv string, err error) + func (b *Bridge) StartChainTransactionScanJob() + func (b *Bridge) StartPoolTransactionScanJob() + func (b *Bridge) StartSwapHistoryScanJob() + func (b *Bridge) ToCompressedPublicKey(pkData []byte) ([]byte, error) + func (b *Bridge) VerifyAggregateMsgHash(msgHash []string, args *tokens.BuildTxArgs) error + func (b *Bridge) VerifyChainConfig() + func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHash []string) (err error) + func (b *Bridge) VerifyP2shTransaction(pairID, txHash, bindAddress string, allowUnstable bool) (*tokens.TxSwapInfo, error) + func (b *Bridge) VerifyRedeemScript(prevScript, redeemScript []byte) error + func (b *Bridge) VerifyTokenConfig(tokenCfg *tokens.TokenConfig) error + func (b *Bridge) VerifyTransaction(pairID, txHash string, allowUnstable bool) (*tokens.TxSwapInfo, error) + type BridgeInterface interface + AggregateUtxos func(addrs []string, utxos []*electrs.ElectUtxo) (string, error) + FindUtxos func(addr string) ([]*electrs.ElectUtxo, error) + GetCompressedPublicKey func(fromPublicKey string, needVerify bool) (cPkData []byte, err error) + GetOutspend func(txHash string, vout uint32) (*electrs.ElectOutspend, error) + GetP2shAddress func(bindAddr string) (p2shAddress string, redeemScript []byte, err error) + ShouldAggregate func(aggUtxoCount int, aggSumVal uint64) bool + StartChainTransactionScanJob func() + StartPoolTransactionScanJob func() + StartSwapHistoryScanJob func() + VerifyAggregateMsgHash func(msgHash []string, args *tokens.BuildTxArgs) error + VerifyP2shTransaction func(pairID, txHash, bindAddress string, allowUnstable bool) (*tokens.TxSwapInfo, error) + var BridgeInstance BridgeInterface + type EncAuthoredTx struct + ChangeIndex int + TotalInput btcAmountType + Tx *EncMsgTx + type EncMsgTx struct + LockTime uint32 + TxIn []*EncTxIn + TxOut []*EncTxOut + Txid string + Version int32 + type EncOutPoint struct + Hash string + Index uint32 + type EncTxIn struct + PreviousOutPoint EncOutPoint + Sequence uint32 + SignatureScript string + Value btcAmountType + Witness []hexutil.Bytes + type EncTxOut struct + PkScript string + Value int64 + type Inheritable interface + GetChainParams func() *chaincfg.Params v0.3.9-1 Nov 26, 2021