Documentation ¶
Index ¶
- Variables
- func CalculateFee(tx *Transaction, protocol ProtocolParams) uint64
- func DecodeAddress(data []byte) (Address, Address, error)
- func LiveTTL() uint64
- func ParseUint64(s string) (uint64, error)
- type Address
- type Certificate
- type Client
- func (c *Client) Close()
- func (c *Client) CreateWallet(name, password string) (*Wallet, string, error)
- func (c *Client) DeleteWallet(id string) error
- func (c *Client) RestoreWallet(name, password, mnemonic string) (*Wallet, error)
- func (c *Client) SaveWallet(w *Wallet) error
- func (c *Client) Wallet(id string) (*Wallet, error)
- func (c *Client) Wallets() ([]*Wallet, error)
- type DB
- type Network
- type NodeTip
- type Options
- type ProtocolParams
- type TXBodyBuilder
- type TXBuilder
- func (builder *TXBuilder) AddFee(address Address) error
- func (builder *TXBuilder) AddInput(xvk crypto.ExtendedVerificationKey, txId TransactionID, index, amount uint64)
- func (builder *TXBuilder) AddInputWithoutSig(txId TransactionID, index, amount uint64)
- func (builder *TXBuilder) AddOutput(address Address, amount uint64)
- func (builder *TXBuilder) Build() Transaction
- func (builder *TXBuilder) SetFee(fee uint64)
- func (builder *TXBuilder) SetTtl(ttl uint64)
- func (builder *TXBuilder) Sign(xsk crypto.ExtendedSigningKey)
- type TXBuilderInput
- type TXBuilderOutput
- type Transaction
- type TransactionBody
- type TransactionID
- type TransactionInput
- type TransactionOutput
- type TransactionWitnessSet
- type Utxo
- type VKeyWitness
- type Wallet
Constants ¶
This section is empty.
Variables ¶
var ShelleyProtocol = ProtocolParams{
MinimumUtxoValue: 1000000,
MinFeeA: 44,
MinFeeB: 155381,
}
Functions ¶
func CalculateFee ¶
func CalculateFee(tx *Transaction, protocol ProtocolParams) uint64
func ParseUint64 ¶
Types ¶
type Address ¶
type Address string
Address is the bech32 representation of a cardano address
func Bech32ToAddress ¶
Bech32ToAddress creates an Address from a bech32 encoded string.
func BytesToAddress ¶
BytesToAddress creates an Address from a byte slice.
func NewEnterpriseAddress ¶
func NewEnterpriseAddress(xvk crypto.ExtendedVerificationKey, network Network) Address
type Certificate ¶
type Certificate struct{}
TODO: This should a cbor array with one element:
stake_registration stake_deregistration stake_delegation pool_registration pool_retirement genesis_key_delegation move_instantaneous_rewards_cert
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a clean interface for creating, saving and deleting Wallets.
func NewClient ¶
NewClient builds a new Client using cardano-cli as the default connection to the Blockhain.
It uses BadgerDB as the default Wallet storage.
func (*Client) CreateWallet ¶
CreateWallet creates a new Wallet using a secure entropy and password, returning a Wallet with its corresponding 24 word mnemonic
func (*Client) DeleteWallet ¶
DeleteWallet removes a Wallet with the given id from the Client's storage.
func (*Client) RestoreWallet ¶
RestoreWallet restores a Wallet from a mnemonic and password.
func (*Client) SaveWallet ¶
SaveWallet saves a Wallet in the Client's storage.
type Options ¶
type Options interface {
// contains filtered or unexported methods
}
func WithSocket ¶
type ProtocolParams ¶
type TXBodyBuilder ¶
type TXBodyBuilder struct { Protocol ProtocolParams TTL uint64 }
func (TXBodyBuilder) Build ¶
func (builder TXBodyBuilder) Build(receiver Address, pickedUtxos []Utxo, amount uint64, change Address) (*TransactionBody, error)
type TXBuilder ¶
type TXBuilder struct {
// contains filtered or unexported fields
}
func NewTxBuilder ¶
func NewTxBuilder(protocol ProtocolParams) *TXBuilder
func (*TXBuilder) AddInput ¶
func (builder *TXBuilder) AddInput(xvk crypto.ExtendedVerificationKey, txId TransactionID, index, amount uint64)
func (*TXBuilder) AddInputWithoutSig ¶
func (builder *TXBuilder) AddInputWithoutSig(txId TransactionID, index, amount uint64)
func (*TXBuilder) Build ¶
func (builder *TXBuilder) Build() Transaction
func (*TXBuilder) Sign ¶
func (builder *TXBuilder) Sign(xsk crypto.ExtendedSigningKey)
type TXBuilderInput ¶
type TXBuilderInput struct {
// contains filtered or unexported fields
}
type TXBuilderOutput ¶
type TXBuilderOutput struct {
// contains filtered or unexported fields
}
type Transaction ¶
type Transaction struct { Body TransactionBody WitnessSet TransactionWitnessSet Metadata *transactionMetadata // or null // contains filtered or unexported fields }
func DecodeTransaction ¶
func DecodeTransaction(cborHex string) (*Transaction, error)
func (*Transaction) Bytes ¶
func (tx *Transaction) Bytes() []byte
func (*Transaction) CborHex ¶
func (tx *Transaction) CborHex() string
func (*Transaction) ID ¶
func (tx *Transaction) ID() TransactionID
type TransactionBody ¶
type TransactionBody struct { Inputs []TransactionInput `cbor:"0,keyasint"` Outputs []TransactionOutput `cbor:"1,keyasint"` Fee uint64 `cbor:"2,keyasint"` Ttl uint64 `cbor:"3,keyasint"` Certificates []Certificate `cbor:"4,keyasint,omitempty"` // Omit for now Withdrawals *uint `cbor:"5,keyasint,omitempty"` // Omit for now Update *uint `cbor:"6,keyasint,omitempty"` // Omit for now MetadataHash *uint `cbor:"7,keyasint,omitempty"` // Omit for now }
func (*TransactionBody) AddSignatures ¶
func (body *TransactionBody) AddSignatures(publicKeys [][]byte, signatures [][]byte) (*Transaction, error)
func (*TransactionBody) Bytes ¶
func (body *TransactionBody) Bytes() []byte
func (*TransactionBody) ID ¶
func (body *TransactionBody) ID() TransactionID
type TransactionID ¶
type TransactionID string
func (TransactionID) Bytes ¶
func (id TransactionID) Bytes() []byte
type TransactionInput ¶
type TransactionOutput ¶
type TransactionWitnessSet ¶
type TransactionWitnessSet struct {
VKeyWitnessSet []VKeyWitness `cbor:"0,keyasint,omitempty"`
}
type VKeyWitness ¶
type Wallet ¶
func (*Wallet) AddAddress ¶
AddAddress generates a new payment address and adds it to the wallet.