Documentation ¶
Index ¶
- Constants
- Variables
- func EncodePublicDataToAddress(public []byte, chainnet string) (string, error)
- func EncodePublicKeyToAddress(publicKey, chainnet string) (string, error)
- func FetchTransactionDetail(hashString, chainnet string) (*base.TransactionDetail, error)deprecated
- func FetchTransactionStatus(hashString string, chainnet string) base.TransactionStatusdeprecated
- func IsValidAddress(address, chainnet string) bool
- func QueryBalance(address, chainnet string) (string, error)deprecated
- func QueryBalancePubkey(pubkey, chainnet string) (string, error)deprecated
- func SdkBatchTransactionStatus(hashListString string, chainnet string) stringdeprecated
- func SendRawTransaction(signedTx string, chainnet string) (string, error)deprecated
- type Account
- func (a *Account) Address() string
- func (a *Account) DecodeAddressToPublicKey(address string) (string, error)
- func (a *Account) DeriveAccountAt(chainnet string) (*Account, error)
- func (a *Account) EncodePublicKeyToAddress(publicKey string) (string, error)
- func (a *Account) IsValidAddress(address string) bool
- func (a *Account) PrivateKey() ([]byte, error)
- func (a *Account) PrivateKeyHex() (string, error)
- func (a *Account) PublicKey() []byte
- func (a *Account) PublicKeyHex() string
- func (a *Account) Sign(message []byte, password string) ([]byte, error)
- func (a *Account) SignHex(messageHex string, password string) (*base.OptionalString, error)
- type Chain
- func (c *Chain) BalanceOfAccount(account base.Account) (*base.Balance, error)
- func (c *Chain) BalanceOfAddress(address string) (*base.Balance, error)
- func (c *Chain) BalanceOfPublicKey(publicKey string) (*base.Balance, error)
- func (c *Chain) BatchFetchTransactionStatus(hashListString string) string
- func (t *Chain) BuildTransfer(sender, receiver, amount string) (txn base.Transaction, err error)
- func (t *Chain) BuildTransferAll(sender, receiver string) (txn base.Transaction, err error)
- func (t *Chain) CanTransferAll() bool
- func (c *Chain) Chain() base.Chain
- func (c *Chain) EstimateTransactionFee(transaction base.Transaction) (fee *base.OptionalString, err error)
- func (c *Chain) EstimateTransactionFeeUsePublicKey(transaction base.Transaction, pubkey string) (fee *base.OptionalString, err error)
- func (c *Chain) FetchTransactionDetail(hash string) (*base.TransactionDetail, error)
- func (c *Chain) FetchTransactionStatus(hash string) base.TransactionStatus
- func (c *Chain) MainToken() base.Token
- func (c *Chain) SendRawTransaction(signedTx string) (string, error)
- func (c *Chain) TokenInfo() (*base.TokenInfo, error)
- type FeeRate
- type Util
Constants ¶
const ( ChainSignet = "signet" ChainMainnet = "mainnet" // ComingChat used, similar mainnet's alias. ChainBitcoin = "bitcoin" )
Variables ¶
Functions ¶
func EncodePublicKeyToAddress ¶
@param publicKey can start with 0x or not.
func FetchTransactionDetail
deprecated
func FetchTransactionDetail(hashString, chainnet string) (*base.TransactionDetail, error)
Deprecated: FetchTransactionDetail is deprecated. Please Use Chain.FetchTransactionDetail() instead.
func FetchTransactionStatus
deprecated
func FetchTransactionStatus(hashString string, chainnet string) base.TransactionStatus
Deprecated: FetchTransactionStatus is deprecated. Please Use Chain.FetchTransactionStatus() instead.
func QueryBalance
deprecated
func QueryBalancePubkey
deprecated
func SdkBatchTransactionStatus
deprecated
func SendRawTransaction
deprecated
Types ¶
type Account ¶
type Account struct { Chainnet string // contains filtered or unexported fields }
func AccountWithPrivateKey ¶
func AsBitcoinAccount ¶
func NewAccountWithMnemonic ¶
func (*Account) DecodeAddressToPublicKey ¶
@return publicKey that will start with 0x.
func (*Account) DeriveAccountAt ¶
func (*Account) EncodePublicKeyToAddress ¶
@param publicKey can start with 0x or not.
func (*Account) IsValidAddress ¶
func (*Account) PrivateKeyHex ¶
@return privateKey string that will start with 0x.
func (*Account) PublicKeyHex ¶
@return publicKey string that will start with 0x.
type Chain ¶
type Chain struct {
*Util
}
func NewChainWithChainnet ¶
func (*Chain) BalanceOfAccount ¶
func (*Chain) BalanceOfAddress ¶
func (*Chain) BalanceOfPublicKey ¶
func (*Chain) BatchFetchTransactionStatus ¶
func (*Chain) BuildTransfer ¶
func (t *Chain) BuildTransfer(sender, receiver, amount string) (txn base.Transaction, err error)
func (*Chain) BuildTransferAll ¶
func (t *Chain) BuildTransferAll(sender, receiver string) (txn base.Transaction, err error)
func (*Chain) CanTransferAll ¶
func (*Chain) EstimateTransactionFee ¶
func (c *Chain) EstimateTransactionFee(transaction base.Transaction) (fee *base.OptionalString, err error)
func (*Chain) EstimateTransactionFeeUsePublicKey ¶
func (c *Chain) EstimateTransactionFeeUsePublicKey(transaction base.Transaction, pubkey string) (fee *base.OptionalString, err error)
func (*Chain) FetchTransactionDetail ¶
func (c *Chain) FetchTransactionDetail(hash string) (*base.TransactionDetail, error)
Fetch transaction details through transaction hash Note: The input parsing of bitcoin is very complex and the network cost is relatively high, So only the status and timestamp can be queried.
func (*Chain) FetchTransactionStatus ¶
func (c *Chain) FetchTransactionStatus(hash string) base.TransactionStatus
func (*Chain) SendRawTransaction ¶
Send the raw transaction on-chain @return the hex hash string
type FeeRate ¶
func SuggestFeeRate ¶
type Util ¶
type Util struct {
Chainnet string
}
func NewUtilWithChainnet ¶
func (*Util) DecodeAddressToPublicKey ¶
Warning: Btc cannot support decode address to public key
func (*Util) EncodePublicDataToAddress ¶
func (*Util) EncodePublicKeyToAddress ¶
@param publicKey can start with 0x or not.