hedera

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2018 License: Apache-2.0 Imports: 5 Imported by: 3

README

Hedera Go SDK

Hedera SDK for Go

Requirements

  • Go 1.11+

  • Git LFS – Git LFS is used to version the built libraries in ./libs (built from hedera-sdk-rust). This must be installed on your system prior to go get.

    • MacOS (homebrew)

      $ brew install git-lfs
      $ git lfs install
      
    • Ubuntu / Debian

      $ sudo apt install git-lfs
      $ git lfs install
      
    • Windows

      Download and run git-lfs.exe. Open your git console ( under Git Bash if you installed Git through https://git-scm.com/ ).

      $ git lfs install
      

Install

$ go get github.com/hashgraph/hedera-sdk-go

License

Licensed under Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountID

type AccountID struct {
	Realm   int64 `json:"realm"`
	Shard   int64 `json:"shard"`
	Account int64 `json:"account"`
}

func AccountIDFromString

func AccountIDFromString(s string) (AccountID, error)

Parse an account ID from the string. Expects a string of the form: {realm}:{shard}:{account}

func NewAccountID

func NewAccountID(realm, shard, account int64) AccountID

type Client

type Client struct {
	// contains filtered or unexported fields
}

func Dial

func Dial(address string) (Client, error)

func (*Client) Close

func (client *Client) Close()

func (*Client) CreateAccount

func (client *Client) CreateAccount() TransactionCreateAccount

func (*Client) CryptoTransfer

func (client *Client) CryptoTransfer() TransactionCryptoTransfer

func (*Client) GetAccountBalance

func (client *Client) GetAccountBalance(id AccountID) QueryGetAccountBalance

func (*Client) GetTransactionReceipt

func (client *Client) GetTransactionReceipt(id TransactionID) QueryGetTransactionReceipt

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

An ed25519 public key.

func PublicKeyFromString

func PublicKeyFromString(s string) (PublicKey, error)

Parse a [HederaPublicKey] from a hex-encoded string.

func (PublicKey) String

func (key PublicKey) String() string

Format this PublicKey as a hex-encoded string of the secret key encoded with a PKIX wrapper ( defined in RFC 3280).

func (PublicKey) Verify

func (key PublicKey) Verify(message []byte, signature Signature) (bool, error)

verify a message and its Signature are were signed by the SecretKey associated with this PublicKey

type Query

type Query struct {
	// contains filtered or unexported fields
}

func (Query) Cost

func (query Query) Cost() (uint64, error)

type QueryGetAccountBalance

type QueryGetAccountBalance struct {
	Query
}

func (QueryGetAccountBalance) Answer

func (query QueryGetAccountBalance) Answer() (uint64, error)

type QueryGetTransactionReceipt

type QueryGetTransactionReceipt struct {
	Query
}

func (QueryGetTransactionReceipt) Answer

type SecretKey

type SecretKey struct {
	// contains filtered or unexported fields
}

An EdDSA secret key.

func GenerateSecretKey

func GenerateSecretKey() SecretKey

Generate a new SecretKey from a cryptographically secure pseudo-random number generator (CSPRNG).

func SecretKeyFromString

func SecretKeyFromString(s string) (SecretKey, error)

Parse a [HederaSecretKey] from a hex-encoded string.

func (SecretKey) Public

func (key SecretKey) Public() PublicKey

Derive a PublicKey from this SecretKey.

func (SecretKey) Sign

func (key SecretKey) Sign(message []byte) (Signature, error)

Sign a message with this SecretKey

func (SecretKey) String

func (key SecretKey) String() string

Format this SecretKey as a hex-encoded string of the secret key encoded with a PKCS #8 wrapper ( defined in RFC 5208).

type Signature

type Signature struct {
	// contains filtered or unexported fields
}

A Signature signed by a Secret Key

func SignatureFromString

func SignatureFromString(s string) (Signature, error)

Parse a Signature from a hex-encoded string.

func (Signature) String

func (signature Signature) String() string

Format this Signature as a hex-encoded string of the signature

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

func (Transaction) Execute

func (tx Transaction) Execute() (TransactionResponse, error)

func (Transaction) Memo

func (tx Transaction) Memo(memo string) Transaction

func (Transaction) Node

func (tx Transaction) Node(id AccountID) Transaction

func (Transaction) Operator

func (tx Transaction) Operator(id AccountID) Transaction

func (Transaction) Sign

func (tx Transaction) Sign(key SecretKey) Transaction

type TransactionCreateAccount

type TransactionCreateAccount struct {
	Transaction
}

func (TransactionCreateAccount) InitialBalance

func (tx TransactionCreateAccount) InitialBalance(balance uint64) TransactionCreateAccount

func (TransactionCreateAccount) Key

func (TransactionCreateAccount) Memo

func (TransactionCreateAccount) Node

func (TransactionCreateAccount) Operator

func (TransactionCreateAccount) Sign

type TransactionCryptoTransfer

type TransactionCryptoTransfer struct {
	Transaction
}

func (TransactionCryptoTransfer) Memo

func (TransactionCryptoTransfer) Node

func (TransactionCryptoTransfer) Operator

func (TransactionCryptoTransfer) Sign

func (TransactionCryptoTransfer) Transfer

type TransactionID

type TransactionID struct {
	AccountID             AccountID
	TransactionValidStart time.Time
}

func TransactionIDFromString

func TransactionIDFromString(s string) (TransactionID, error)

func (TransactionID) String

func (id TransactionID) String() string

type TransactionReceipt

type TransactionReceipt struct {
	Status    TransactionStatus
	AccountID *AccountID
}

type TransactionResponse

type TransactionResponse struct {
	ID TransactionID
}

type TransactionStatus

type TransactionStatus uint8
const (
	TransactionStatusUnkown      TransactionStatus = 0
	TransactionStatusSuccess     TransactionStatus = 1
	TransactionStatusFailInvalid TransactionStatus = 2
	TransactionStatusFailFee     TransactionStatus = 3
	TransactionStatusFailBalance TransactionStatus = 4
)

func (TransactionStatus) String

func (status TransactionStatus) String() string

Directories

Path Synopsis
tck module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL