Versions in this module Expand all Collapse all v3 v3.6.2 Feb 8, 2023 Changes in this version + var UnlockMemoPrefix = "SWAPTX:" + func DecodeWIF(wif string) (*btcutil.WIF, error) + func EstimateFeePerKb(url string, blocks int) (fee int64, err error) + func GetBindAddressFromMemoScipt(memoScript string) (bind string, toChainID string, ok bool) + func GetLatestBlockNumber(url string) (result uint64, err error) + func GetP2shBindAddress(p2shAddress string) (bindAddress string) + func GetStubChainID(network string) *big.Int + func PostTransaction(url, txHex string) (txHash string, err error) + func SupportsChainID(chainID *big.Int) bool + type Bridge struct + func NewCrossChainBridge() *Bridge + func (b *Bridge) BroadcastTxCommit(txHex string) (txHash string, err error) + func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error) + func (b *Bridge) CalcSignatureHash(sigScript []byte, tx *wire.MsgTx, i int) (sigHash []byte, 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) (result int64, err error) + func (b *Bridge) FindUtxos(addr string) (result []*ElectUtxo, err error) + func (b *Bridge) GetChainParams(chainID *big.Int) *chaincfg.Params + func (b *Bridge) GetCompressedPublicKey(fromPublicKey string, needVerify bool) (cPkData []byte, err error) + func (b *Bridge) GetElectTransactionStatus(txHash string) (result *ElectTxStatus, err error) + func (b *Bridge) GetLatestBlockNumber() (result uint64, err error) + func (b *Bridge) GetLatestBlockNumberOf(apiAddress string) (uint64, 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) GetPublicKeyFromECDSA(privKey *ecdsa.PrivateKey, compressed bool) []byte + func (b *Bridge) GetReceivedValue(vout []*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) GetTransaction(txHash string) (tx interface{}, err error) + func (b *Bridge) GetTransactionByHash(txHash string) (result *ElectTx, err error) + func (b *Bridge) GetTransactionStatus(txHash string) (status *tokens.TxStatus, err error) + func (b *Bridge) InitAfterConfig() + func (b *Bridge) InitRouterInfo(routerContract, routerVersion string) (err error) + func (b *Bridge) IsPayToScriptHash(sigScript []byte) bool + func (b *Bridge) IsValidAddress(address string) bool + func (b *Bridge) MPCSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signedTx interface{}, txHash string, err error) + 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) 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 []*wire.TxOut, relayFeePerKb btcutil.Amount, ...) (*txauthor.AuthoredTx, error) + func (b *Bridge) NullDataScript(memo string) ([]byte, error) + func (b *Bridge) ParsePkScript(pkScript []byte) (txscript.PkScript, error) + func (b *Bridge) PublicKeyToAddress(pubKey string) (string, error) + func (b *Bridge) RegisterSwap(txHash string, args *tokens.RegisterArgs) ([]*tokens.SwapTxInfo, []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) SetTokenConfig(tokenAddr string, tokenCfg *tokens.TokenConfig) + func (b *Bridge) SignTransactionWithPrivateKey(rawTx interface{}, wifPrivKey string) (signedTx interface{}, txHash string, err error) + func (b *Bridge) SignWithECDSA(privKey *ecdsa.PrivateKey, msgHash []byte) (rsv string, err error) + func (b *Bridge) ToCompressedPublicKey(pkData []byte) ([]byte, error) + func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHashes []string) (err error) + func (b *Bridge) VerifyPubKey(address, pubKey string) error + func (b *Bridge) VerifyRedeemScript(prevScript, redeemScript []byte) error + func (b *Bridge) VerifyTokenConfig(tokenCfg *tokens.TokenConfig) error + func (b *Bridge) VerifyTransaction(txHash string, args *tokens.VerifyArgs) (*tokens.SwapTxInfo, error) + type ElectBlock struct + Bits *uint32 + Difficulty *uint64 + Hash *string + Height *uint32 + MerkleRoot *string + Nonce *uint32 + PreviousHash *string + Size *uint32 + Timestamp *uint32 + TxCount *uint32 + Version *uint32 + Weight *uint32 + type ElectOutspend struct + Spent *bool + Status *ElectTxStatus + Txid *string + Vin *uint32 + func (outspend *ElectOutspend) String() string + type ElectTx struct + Fee *uint64 + Locktime *uint32 + Size *uint32 + Status *ElectTxStatus + Txid *string + Version *uint32 + Vin []*ElectTxin + Vout []*ElectTxOut + Weight *uint32 + func GetTransactionByHash(url, txHash string) (*ElectTx, error) + type ElectTxOut struct + Scriptpubkey *string + ScriptpubkeyAddress *string + ScriptpubkeyAsm *string + ScriptpubkeyType *string + Value *uint64 + type ElectTxStatus struct + BlockHash *string + BlockHeight *uint64 + BlockTime *uint64 + Confirmed *bool + func GetElectTransactionStatus(url, txHash string) (result *ElectTxStatus, err error) + func (status *ElectTxStatus) String() string + type ElectTxin struct + InnerRedeemscriptAsm *string + IsCoinbase *bool + Prevout *ElectTxOut + Scriptsig *string + ScriptsigAsm *string + Sequence *uint32 + Txid *string + Vout *uint32 + type ElectUtxo struct + Status *ElectTxStatus + Txid *string + Value *uint64 + Vout *uint32 + func FindUtxos(url string, addr string) (result []*ElectUtxo, err error) + func (utxo *ElectUtxo) String() string + type SortableElectUtxoSlice []*ElectUtxo + func (s SortableElectUtxoSlice) Len() int + func (s SortableElectUtxoSlice) Less(i, j int) bool + func (s SortableElectUtxoSlice) Swap(i, j int)