wallet

package
v0.0.0-...-68f1f64 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transaction

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

func NewTransaction

func NewTransaction(
	message string,
	recipient string,
	sender string,
	privateKey *ecdsa.PrivateKey,
	publicKey *ecdsa.PublicKey,
	value float32) *Transaction

NewTransaction creates a new transaction with the given details.

func (*Transaction) GenerateSignature

func (t *Transaction) GenerateSignature() *utils.Signature

GenerateSignature generates the signature for the transaction.

func (*Transaction) MarshalJSON

func (t *Transaction) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of the transaction.

type TransactionRequest

type TransactionRequest struct {
	Message                    *string `json:"message"`
	RecipientBlockchainAddress *string `json:"recipientBlockchainAddress"`
	SenderBlockchainAddress    *string `json:"senderBlockchainAddress"`
	SenderPrivateKey           *string `json:"senderPrivateKey"`
	SenderPublicKey            *string `json:"senderPublicKey"`
	Value                      *string `json:"value"`
}

func (*TransactionRequest) Validate

func (tr *TransactionRequest) Validate() bool

Validate checks if all the required fields in the transaction request are present.

type Wallet

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

func NewWallet

func NewWallet() *Wallet

func (*Wallet) BlockchainAddress

func (w *Wallet) BlockchainAddress() string

BlockchainAddress returns the blockchain address associated with the wallet.

func (*Wallet) MarshalJSON

func (w *Wallet) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of the wallet.

func (*Wallet) PrivateKey

func (w *Wallet) PrivateKey() *ecdsa.PrivateKey

PrivateKey returns the ECDSA private key of the wallet.

func (*Wallet) PrivateKeyStr

func (w *Wallet) PrivateKeyStr() string

PrivateKeyStr returns the hexadecimal representation of the private key.

func (*Wallet) PublicKey

func (w *Wallet) PublicKey() *ecdsa.PublicKey

PublicKey returns the ECDSA public key of the wallet.

func (*Wallet) PublicKeyStr

func (w *Wallet) PublicKeyStr() string

PublicKeyStr returns the hexadecimal representation of the public key.

Jump to

Keyboard shortcuts

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