Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidPrivate(priWif string) bool
- func IsValidPublic(priWif string) bool
- func PrivateToPublic(priWif string) (string, error)
- type Address
- type AssetAmount
- type Buffer
- type FillOrderOperation
- type KeyPair
- type LimitOrderCancelOperation
- type LimitOrderCreateOperation
- type Memo
- type ObjectID
- type OpType
- type Operation
- type Operations
- type Price
- type PrivateKey
- func (p PrivateKey) Bytes() []byte
- func (p PrivateKey) ECPrivateKey() *btcec.PrivateKey
- func (p PrivateKey) PublicKey() *PublicKey
- func (p PrivateKey) SharedSecret(pub *PublicKey, skLen, macLen int) (sk []byte, err error)
- func (p PrivateKey) SignCompact(hash []byte) (sig []byte, err error)
- func (p PrivateKey) ToECDSA() *ecdsa.PrivateKey
- func (p PrivateKey) ToHex() string
- func (p PrivateKey) ToWIF() string
- type PrivateKeys
- type PublicKey
- func (p PublicKey) Bytes() []byte
- func (p PublicKey) Equal(pub *PublicKey) bool
- func (p PublicKey) MarshalJSON() ([]byte, error)
- func (p PublicKey) MaxSharedKeyLength() int
- func (p PublicKey) String() string
- func (p *PublicKey) ToAddress() (*Address, error)
- func (p PublicKey) ToECDSA() *ecdsa.PublicKey
- func (p *PublicKey) UnmarshalJSON(data []byte) error
- type PublicKeys
- type Suint32
- type Suint64
- type Time
- type Transaction
- type TransferOperation
- type UInt64
- type UnknownOperation
Constants ¶
const Layout = `"2006-01-02T15:04:05"`
Variables ¶
var ( ErrInvalidCurve = fmt.Errorf("invalid elliptic curve") )
Functions ¶
func PrivateToPublic ¶
Export public key from private key
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func NewAddress ¶
func NewAddressFromString ¶
type AssetAmount ¶
func (AssetAmount) MarshalTransaction ¶
func (aa AssetAmount) MarshalTransaction(encoder *transaction.Encoder) error
func (*AssetAmount) UnmarshalJSON ¶
func (aa *AssetAmount) UnmarshalJSON(b []byte) (err error)
RPC client might return asset amount as uint64 or string, therefore a custom unmarshaller is used
type FillOrderOperation ¶
type FillOrderOperation struct { Order ObjectID Account ObjectID Pays AssetAmount Recives AssetAmount Fee AssetAmount Price Price IsMaker bool }
FillOrderOpType
func (*FillOrderOperation) Type ¶
func (op *FillOrderOperation) Type() OpType
type KeyPair ¶
type KeyPair struct { BrainKey string PrivateKey *PrivateKey }
func GenerateKeyPair ¶
Generates the key pair
type LimitOrderCancelOperation ¶
type LimitOrderCancelOperation struct { Fee AssetAmount `json:"fee"` FeePayingAccount ObjectID `json:"fee_paying_account"` Order ObjectID `json:"order"` Extensions []json.RawMessage `json:"extensions"` }
LimitOrderCancelOpType
func (*LimitOrderCancelOperation) MarshalTransaction ¶
func (op *LimitOrderCancelOperation) MarshalTransaction(encoder *transaction.Encoder) error
func (*LimitOrderCancelOperation) Type ¶
func (op *LimitOrderCancelOperation) Type() OpType
type LimitOrderCreateOperation ¶
type LimitOrderCreateOperation struct { Fee AssetAmount `json:"fee"` Seller ObjectID `json:"seller"` AmountToSell AssetAmount `json:"amount_to_sell"` MinToReceive AssetAmount `json:"min_to_receive"` Expiration Time `json:"expiration"` FillOrKill bool `json:"fill_or_kill"` Extensions []json.RawMessage `json:"extensions"` }
LimitOrderCreateOperation
func (*LimitOrderCreateOperation) MarshalTransaction ¶
func (op *LimitOrderCreateOperation) MarshalTransaction(encoder *transaction.Encoder) error
func (*LimitOrderCreateOperation) Type ¶
func (op *LimitOrderCreateOperation) Type() OpType
type Memo ¶
type Memo struct { From PublicKey `json:"from"` To PublicKey `json:"to"` Nonce UInt64 `json:"nonce"` Message Buffer `json:"message"` }
func (Memo) Decrypt ¶
func (p Memo) Decrypt(priv *PrivateKey) (string, error)
Decrypt calculates a shared secret by the receivers private key and the senders public key, then decrypts the given memo message.
type ObjectID ¶
On the BitShares blockchains there are no addresses, but objects identified by a unique id, an type and a space in the form: space.type.id
func MustParseObjectID ¶
func ParseObjectID ¶
func (*ObjectID) MarshalJSON ¶
func (ObjectID) MarshalTransaction ¶
func (o ObjectID) MarshalTransaction(encoder *transaction.Encoder) error
func (*ObjectID) UnmarshalJSON ¶
type Operations ¶
type Operations []Operation
func (Operations) MarshalJSON ¶
func (ops Operations) MarshalJSON() ([]byte, error)
func (*Operations) UnmarshalJSON ¶
func (ops *Operations) UnmarshalJSON(b []byte) (err error)
type Price ¶
type Price struct { Base AssetAmount `json:"base"` Quote AssetAmount `json:"quote"` }
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func NewDeterministicPrivateKey ¶
func NewDeterministicPrivateKey(randSource io.Reader) (*PrivateKey, error)
func NewPrivateKeyFromBrainKey ¶
func NewPrivateKeyFromBrainKey(brainKey, seq string) (*PrivateKey, error)
func NewPrivateKeyFromWif ¶
func NewPrivateKeyFromWif(wifPrivateKey string) (*PrivateKey, error)
func (PrivateKey) Bytes ¶
func (p PrivateKey) Bytes() []byte
func (PrivateKey) ECPrivateKey ¶
func (p PrivateKey) ECPrivateKey() *btcec.PrivateKey
func (PrivateKey) PublicKey ¶
func (p PrivateKey) PublicKey() *PublicKey
func (PrivateKey) SharedSecret ¶
func (p PrivateKey) SharedSecret(pub *PublicKey, skLen, macLen int) (sk []byte, err error)
func (PrivateKey) SignCompact ¶
func (p PrivateKey) SignCompact(hash []byte) (sig []byte, err error)
func (PrivateKey) ToECDSA ¶
func (p PrivateKey) ToECDSA() *ecdsa.PrivateKey
func (PrivateKey) ToHex ¶
func (p PrivateKey) ToHex() string
func (PrivateKey) ToWIF ¶
func (p PrivateKey) ToWIF() string
type PrivateKeys ¶
type PrivateKeys []PrivateKey
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func NewPublicKeyFromString ¶
NewPublicKey creates a new PublicKey from string e.g.("GXC6K35Bajw29N4fjP4XADHtJ7bEj2xHJ8CoY2P2s1igXTB5oMBhR")
func (PublicKey) MarshalJSON ¶
func (PublicKey) MaxSharedKeyLength ¶
MaxSharedKeyLength returns the maximum length of the shared key the public key can produce.
func (*PublicKey) UnmarshalJSON ¶
type PublicKeys ¶
type PublicKeys []PublicKey
type Suint32 ¶
type Suint32 uint32
Suint32 uint32 with redeclared JSON unmarshal; Can be parsed from uint32 either string
func (*Suint32) UnmarshalJSON ¶
type Suint64 ¶
type Suint64 uint64
Suint64 uint64 with redeclared JSON unmarshal; Can be parsed from uint64 either string
func (*Suint64) UnmarshalJSON ¶
type Time ¶
func (*Time) MarshalJSON ¶
func (Time) MarshalTransaction ¶
func (t Time) MarshalTransaction(encoder *transaction.Encoder) error
func (*Time) UnmarshalJSON ¶
type Transaction ¶
type Transaction struct { RefBlockNum uint16 `json:"ref_block_num"` RefBlockPrefix uint32 `json:"ref_block_prefix"` Expiration Time `json:"expiration"` Operations Operations `json:"operations"` Signatures []string `json:"signatures"` }
func (*Transaction) MarshalTransaction ¶
func (tx *Transaction) MarshalTransaction(encoder *transaction.Encoder) error
MarshalTransaction implements transaction.Marshaller interface.
func (*Transaction) PushOperation ¶
func (tx *Transaction) PushOperation(op Operation)
PushOperation can be used to add an operation into the transaction.
type TransferOperation ¶
type TransferOperation struct { From ObjectID `json:"from"` To ObjectID `json:"to"` Amount AssetAmount `json:"amount"` Fee AssetAmount `json:"fee"` Memo *Memo `json:"memo,omitempty"` Extensions []json.RawMessage `json:"extensions"` }
TransferOperation
func NewTransferOperation ¶
func NewTransferOperation(from, to ObjectID, amount, fee AssetAmount, memo *Memo) *TransferOperation
NewTransferOperation returns a new instance of TransferOperation
func (*TransferOperation) MarshalTransaction ¶
func (op *TransferOperation) MarshalTransaction(encoder *transaction.Encoder) error
func (*TransferOperation) Type ¶
func (op *TransferOperation) Type() OpType
type UnknownOperation ¶
type UnknownOperation struct { Data json.RawMessage // contains filtered or unexported fields }
UnknownOperation
func (*UnknownOperation) Type ¶
func (op *UnknownOperation) Type() OpType