Documentation ¶
Index ¶
- Constants
- Variables
- func AbelToNeutrino(abelAmount float64) int64
- func DecodeValueFromTxOutData(txOutData Bytes, viewSecretKey *CryptoKey) (int64, error)
- func GenerateCryptoSeedFromMnemonic(mnemonic []string, sequenceNumber uint64) ([]byte, error)
- func GenerateRandomMnemonic() ([]string, error)
- func GetRingBlockHeights(height int64) []int64
- func NeutrinoToAbel(neutrinoAmount int64) float64
- type AbecBlock
- type AbecChainInfo
- type AbecJSONRPCRequest
- type AbecJSONRPCResponse
- type AbecMempool
- type AbecRPCClient
- func (client *AbecRPCClient) GetBlock(hash string) (Bytes, *AbecBlock, error)
- func (client *AbecRPCClient) GetBlockByHeight(height int64) (Bytes, *AbecBlock, error)
- func (client *AbecRPCClient) GetBlockBytes(hash string) (Bytes, error)
- func (client *AbecRPCClient) GetBlockBytesByHeight(height int64) (Bytes, error)
- func (client *AbecRPCClient) GetBlockHash(height int64) (Bytes, *string, error)
- func (client *AbecRPCClient) GetChainInfo() (Bytes, *AbecChainInfo, error)
- func (client *AbecRPCClient) GetEstimatedTxFee() int64
- func (client *AbecRPCClient) GetMempool() (Bytes, *AbecMempool, error)
- func (client *AbecRPCClient) GetRawTx(hash string) (Bytes, *AbecTx, error)
- func (client *AbecRPCClient) GetTxBytes(hash string) (Bytes, error)
- func (client *AbecRPCClient) SendRawTx(txStr string) (Bytes, *string, error)
- type AbecTx
- type AbecTxVin
- type AbecTxVout
- type AbecUTXORing
- type AbelAddress
- type Address
- type AddressType
- type Bytes
- func AbecRPCClientCallForResult[ResultType any](client *AbecRPCClient, result *ResultType, method string, params []interface{}) (Bytes, *ResultType, error)
- func AsBytes(data []byte) Bytes
- func DecodeCoinSerialNumbers(coinIDs []*CoinID, serialNoSecretKeys []*CryptoKey, ...) ([]Bytes, error)
- func GenerateSafeCryptoSeed() (Bytes, error)
- func MakeBytes(length int, capacity ...int) Bytes
- func MakeBytesFromHexString(hexString string) Bytes
- func MakeRandomBytes(length int, seed ...int64) Bytes
- func (b Bytes) Base64String() string
- func (b Bytes) FillRandomData(seed int64, alphabet string)
- func (b Bytes) HexString() string
- func (b Bytes) JSONUnmarshal(v any) error
- func (b Bytes) Len() int
- func (b Bytes) Md5() Bytes
- func (b Bytes) Sha256() Bytes
- func (b Bytes) Slice() []byte
- func (b Bytes) String() string
- func (b Bytes) Summary(verbosity int, affixLen ...int) string
- type Coin
- type CoinAddress
- type CoinID
- type CryptoAddress
- type CryptoKey
- type CryptoKeysAndAddress
- type Logger
- type ShortAbelAddress
- type SignedRawTx
- type TxBlockDesc
- type TxDesc
- type TxInDesc
- type TxOutDesc
- type TxSubmissionResult
- type UnsignedRawTx
Constants ¶
const ( COIN_ADDRESS_LENGTH = 9504 CRYPTO_ADDRESS_LENGTH = 10696 ABEL_ADDRESS_LENGTH = 10729 SHORT_ABEL_ADDRESS_LENGTH = 66 )
const (
DEFAULT_CHAIN_ID = 0x00
)
Define constants.
Variables ¶
var LOG = NewLogger("abelsdk")
Functions ¶
func AbelToNeutrino ¶
func GenerateRandomMnemonic ¶
Types ¶
type AbecBlock ¶
type AbecBlock struct { Height int64 `json:"height"` Confirmations int64 `json:"confirmations"` Version int64 `json:"version"` VersionHex string `json:"versionHex"` Time int64 `json:"time"` Nonce uint64 `json:"nonce"` Size int64 `json:"size"` FullSize int64 `json:"fullsize"` Difficulty float64 `json:"difficulty"` BlockHash string `json:"hash"` PrevBlockHash string `json:"previousblockhash"` NextBlockHash string `json:"nextblockhash"` ContentHash string `json:"contenthash"` MerkleRoot string `json:"merkleroot"` Bits string `json:"bits"` SealHash string `json:"sealhash"` Mixdigest string `json:"mixdigest"` TxHashes []string `json:"tx"` RawTxs []*AbecTx `json:"rawTx"` }
type AbecChainInfo ¶
type AbecJSONRPCRequest ¶
type AbecJSONRPCResponse ¶
type AbecJSONRPCResponse struct { Result json.RawMessage `json:"result"` Error json.RawMessage `json:"error"` ID string `json:"id"` }
type AbecMempool ¶
type AbecRPCClient ¶
type AbecRPCClient struct {
// contains filtered or unexported fields
}
Define data types.
func NewAbecRPCClient ¶
func NewAbecRPCClient(endpoint string, username string, password string) *AbecRPCClient
Define methods for AbecRPCClient.
func (*AbecRPCClient) GetBlock ¶
func (client *AbecRPCClient) GetBlock(hash string) (Bytes, *AbecBlock, error)
func (*AbecRPCClient) GetBlockByHeight ¶
func (client *AbecRPCClient) GetBlockByHeight(height int64) (Bytes, *AbecBlock, error)
func (*AbecRPCClient) GetBlockBytes ¶
func (client *AbecRPCClient) GetBlockBytes(hash string) (Bytes, error)
func (*AbecRPCClient) GetBlockBytesByHeight ¶
func (client *AbecRPCClient) GetBlockBytesByHeight(height int64) (Bytes, error)
func (*AbecRPCClient) GetBlockHash ¶
func (client *AbecRPCClient) GetBlockHash(height int64) (Bytes, *string, error)
func (*AbecRPCClient) GetChainInfo ¶
func (client *AbecRPCClient) GetChainInfo() (Bytes, *AbecChainInfo, error)
func (*AbecRPCClient) GetEstimatedTxFee ¶
func (client *AbecRPCClient) GetEstimatedTxFee() int64
func (*AbecRPCClient) GetMempool ¶
func (client *AbecRPCClient) GetMempool() (Bytes, *AbecMempool, error)
func (*AbecRPCClient) GetRawTx ¶
func (client *AbecRPCClient) GetRawTx(hash string) (Bytes, *AbecTx, error)
func (*AbecRPCClient) GetTxBytes ¶
func (client *AbecRPCClient) GetTxBytes(hash string) (Bytes, error)
type AbecTx ¶
type AbecTx struct { Hex string `json:"hex"` TxID string `json:"txid"` TxHash string `json:"hash"` Time int64 `json:"time"` BlockHash string `json:"blockhash"` BlockTime int64 `json:"blocktime"` Confirmations int64 `bson:"confirmations"` Version int64 `json:"version"` Size int64 `json:"size"` FullSize int64 `json:"fullsize"` Fee float64 `json:"fee"` Witness string `json:"witness"` Vin []*AbecTxVin `json:"vin"` Vout []*AbecTxVout `json:"vout"` }
type AbecTxVin ¶
type AbecTxVin struct { UTXORing AbecUTXORing `json:"prevutxoring"` SerialNumber string `json:"serialnumber"` }
type AbecTxVout ¶
type AbecUTXORing ¶
type AbelAddress ¶
type AbelAddress struct {
Address
}
Define the AbelAddress data type.
func NewAbelAddressFromCryptoAddress ¶
func NewAbelAddressFromCryptoAddress(cryptoAddress *CryptoAddress, chainID ...int8) *AbelAddress
func (*AbelAddress) GetChainID ¶
func (a *AbelAddress) GetChainID() int8
func (*AbelAddress) GetChecksum ¶
func (a *AbelAddress) GetChecksum() Bytes
func (*AbelAddress) GetCryptoAddress ¶
func (a *AbelAddress) GetCryptoAddress() *CryptoAddress
func (*AbelAddress) GetShortAbelAddress ¶
func (a *AbelAddress) GetShortAbelAddress() *ShortAbelAddress
func (*AbelAddress) Validate ¶
func (a *AbelAddress) Validate() error
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Define the Address data type.
func NewAddress ¶
func NewAddress(data Bytes, addressType AddressType, fingerprint ...Bytes) Address
Define methods for Address.
func (*Address) Fingerprint ¶
func (*Address) Type ¶
func (a *Address) Type() AddressType
type AddressType ¶
type AddressType int
Define constants.
const ( ANY_ADDRESS_TYPE AddressType = iota COIN_ADDRESS_TYPE CRYPTO_ADDRESS_TYPE ABEL_ADDRESS_TYPE SHORT_ABEL_ADDRESS_TYPE )
func (AddressType) String ¶
func (addressType AddressType) String() string
type Bytes ¶
type Bytes []byte
Define data types.
func AbecRPCClientCallForResult ¶
func AbecRPCClientCallForResult[ResultType any](client *AbecRPCClient, result *ResultType, method string, params []interface{}) (Bytes, *ResultType, error)
func DecodeCoinSerialNumbers ¶
func GenerateSafeCryptoSeed ¶
Define wrapper methods for Abec APIs.
func MakeBytesFromHexString ¶
func MakeRandomBytes ¶
func (Bytes) Base64String ¶
func (Bytes) FillRandomData ¶
func (Bytes) JSONUnmarshal ¶
type Coin ¶
type Coin struct { ID CoinID OwnerShortAddress *ShortAbelAddress OwnerAddress *AbelAddress Value int64 SerialNumber Bytes TxVoutData Bytes BlockHash Bytes BlockHeight int64 }
type CoinAddress ¶
type CoinAddress struct {
Address
}
Define the CoinAddress data type.
func DecodeCoinAddressFromTxOutData ¶
func DecodeCoinAddressFromTxOutData(txOutData Bytes) (*CoinAddress, error)
func (*CoinAddress) Validate ¶
func (a *CoinAddress) Validate() error
type CryptoAddress ¶
type CryptoAddress struct {
Address
}
Define the CryptoAddress data type.
func NewCryptoAddress ¶
func NewCryptoAddress(data Bytes) *CryptoAddress
Define methods for CryptoAddress.
func (*CryptoAddress) GetCoinAddress ¶
func (a *CryptoAddress) GetCoinAddress() *CoinAddress
func (*CryptoAddress) Validate ¶
func (a *CryptoAddress) Validate() error
type CryptoKeysAndAddress ¶
type CryptoKeysAndAddress struct { SpendSecretKey CryptoKey SerialNoSecretKey CryptoKey ViewSecretKey CryptoKey CryptoAddress CryptoAddress }
Define the CryptoKeysAndAddress data type.
func GenerateCryptoKeysAndAddress ¶
func GenerateCryptoKeysAndAddress(cryptoSeed Bytes) (*CryptoKeysAndAddress, error)
type ShortAbelAddress ¶
type ShortAbelAddress struct {
Address
}
Define the ShortAbelAddress data type.
func MakeShortAbelAddress ¶
func MakeShortAbelAddress(fingerprint Bytes, cryptoAddressHash Bytes, chainID ...int8) *ShortAbelAddress
func NewShortAbelAddress ¶
func NewShortAbelAddress(data Bytes) *ShortAbelAddress
Define methods for ShortAbelAddress.
func (*ShortAbelAddress) GetChainID ¶
func (a *ShortAbelAddress) GetChainID() int8
func (*ShortAbelAddress) Validate ¶
func (a *ShortAbelAddress) Validate() error
type SignedRawTx ¶
Define the SignedRawTx data type and methods.
func GenerateSignedRawTx ¶
func GenerateSignedRawTx(unsignedRawTx *UnsignedRawTx, signerKeys []*CryptoKeysAndAddress) (*SignedRawTx, error)
func NewSignedRawTx ¶
func NewSignedRawTx(data Bytes, txid Bytes) *SignedRawTx
type TxBlockDesc ¶
Define the TxBlockDesc data type and methods.
func NewTxBlockDesc ¶
func NewTxBlockDesc(binData Bytes, height int64) *TxBlockDesc
type TxDesc ¶
type TxDesc struct { TxInDescs []*TxInDesc TxOutDescs []*TxOutDesc TxFee int64 TxRingBlockDescs map[int64]*TxBlockDesc }
Define the TxDesc data type and methods.
type TxInDesc ¶
type TxInDesc struct { TxOutData Bytes CoinValue int64 Owner *ShortAbelAddress Height int64 TxHash Bytes TxOutIndex uint8 CoinSerialNumber Bytes }
Define the TxInDesc data type and methods.
func NewTxInDesc ¶
func (*TxInDesc) GetCoinAddress ¶
func (d *TxInDesc) GetCoinAddress() (*CoinAddress, error)
func (*TxInDesc) GetFingerprint ¶
type TxOutDesc ¶
type TxOutDesc struct { AbelAddress *AbelAddress CoinValue int64 }
Define the TxOutDesc data type and methods.
func NewTxOutDesc ¶
func NewTxOutDesc(abelAddress *AbelAddress, coinValue int64) *TxOutDesc
type TxSubmissionResult ¶
type TxSubmissionResult struct { SignedRawTx *SignedRawTx SubmissionTime int64 Success bool Error string }
Define the TxSubmissionResult data type and methods.
type UnsignedRawTx ¶
type UnsignedRawTx struct { Bytes Signers []*ShortAbelAddress }
Define the UnsignedRawTx data type and methods.
func GenerateUnsignedRawTx ¶
func GenerateUnsignedRawTx(txDesc *TxDesc) (*UnsignedRawTx, error)
func NewUnsignedRawTx ¶
func NewUnsignedRawTx(data Bytes, signers ...[]*ShortAbelAddress) *UnsignedRawTx