Documentation ¶
Index ¶
- Constants
- Variables
- func EncodePublicDataToAddress(public []byte, chainnet string) (string, error)
- func EncodePublicKeyToAddress(publicKey string, chainnet string) (string, error)
- func IsValidAddress(address, chainnet string) bool
- type Account
- func (a *Account) Address() string
- func (a *Account) DecodeAddressToPublicKey(address string) (string, 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) FetchUtxos(address string, limit int) (*base.OptionalString, error)
- func (c *Chain) MainToken() base.Token
- func (c *Chain) SendRawTransaction(signedTx string) (string, error)
- func (c *Chain) SendSignedTransaction(signedTxn base.SignedTransaction) (hash *base.OptionalString, err error)
- func (c *Chain) SuggestFeeRate() (*FeeRate, error)
- func (c *Chain) TokenInfo() (*base.TokenInfo, error)
- type FeeRate
- type SDKUTXOList
- type Transaction
- type TransactionInput
- type TransactionOutput
- type UTXO
- type UTXOList
- type Util
Constants ¶
View Source
const ( ChainTestnet = "testnet" ChainMainnet = "mainnet" )
Variables ¶
View Source
var (
ErrUnsupportedChain = errors.New("Unsupported Doge chainnet")
)
Functions ¶
func EncodePublicKeyToAddress ¶
@param publicKey can start with 0x or not.
func IsValidAddress ¶
Types ¶
type Account ¶
type Account struct { Chainnet string // contains filtered or unexported fields }
func AccountWithPrivateKey ¶
func AsDogecoinAccount ¶
func NewAccountWithMnemonic ¶
func (*Account) DecodeAddressToPublicKey ¶
@return publicKey that will start with 0x.
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
func (*Chain) FetchTransactionStatus ¶
func (c *Chain) FetchTransactionStatus(hash string) base.TransactionStatus
func (*Chain) FetchUtxos ¶
@param limit Specify how many the latest utxos to fetch, The minimum value of the limit is 100.
func (*Chain) SendRawTransaction ¶
Send the raw transaction on-chain @return the hex hash string
func (*Chain) SendSignedTransaction ¶
func (c *Chain) SendSignedTransaction(signedTxn base.SignedTransaction) (hash *base.OptionalString, err error)
func (*Chain) SuggestFeeRate ¶
type SDKUTXOList ¶
type Transaction ¶
type Transaction struct { // Demo: https://api.blockcypher.com/v1/doge/main/txs/7bc313903372776e1eb81d321e3fe27c9721ce8e71a9bcfee1bde6baea31b5c2 HashString string `json:"hash"` Total *big.Int `json:"total"` Fees *big.Int `json:"fees"` Received *time.Time `json:"received"` Confirmed *time.Time `json:"confirmed"` Confirmations int64 `json:"confirmations"` Inputs []*TransactionInput `json:"inputs"` Outputs []*TransactionOutput `json:"outputs"` OpReturn string `json:"data_protocol"` }
func (*Transaction) From ¶
func (t *Transaction) From() string
func (*Transaction) SdkDetail ¶
func (t *Transaction) SdkDetail() *base.TransactionDetail
func (*Transaction) Status ¶
func (t *Transaction) Status() base.TransactionStatus
func (*Transaction) ToAddressAndTransferAmount ¶
func (t *Transaction) ToAddressAndTransferAmount() (string, *big.Int)
type TransactionInput ¶
type TransactionInput struct {
Addresses []string `json:"addresses"`
}
type TransactionOutput ¶
type UTXO ¶
type UTXO struct { // input from like // https://api.blockcypher.com/v1/doge/main/addrs/D8aDCsK4TA9NYhmwiqw1BjZ4CP8LQ814Ea?limit=5&unspentOnly=true Txid string `json:"tx_hash"` Index int `json:"tx_output_n"` Value *big.Int `json:"value"` }
func (*UTXO) MarshalJSON ¶
type Util ¶
type Util struct {
Chainnet string
}
func NewUtilWithChainnet ¶
func (*Util) DecodeAddressToPublicKey ¶
Warning: Dogecoin cannot support decode address to public key
func (*Util) EncodePublicDataToAddress ¶
func (*Util) EncodePublicKeyToAddress ¶
@param publicKey can start with 0x or not.
func (*Util) IsValidAddress ¶
Click to show internal directories.
Click to hide internal directories.