service

package
v0.0.0-...-8220f0d Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContractID = "cs-coin"
)

Variables

View Source
var (
	ErrInsufficientFunds      = errors.New("unsufficient funds in the wallet")
	ErrInvalidSignature       = errors.New("invalid signature")
	ErrInvalidSignatureFormat = errors.New("invalid signature format")
	ErrInvalidPubKeyFormat    = errors.New("invalid public key format")
)

Functions

This section is empty.

Types

type CheckerTrace

type CheckerTrace struct {
	Dependencies    []CheckerTrace `json:"dependencies"`
	Inputs          []string       `json:"inputs"`
	Outputs         []OutputObject `json:"outputs"`
	Parameters      []string       `json:"parameters"`
	ReferenceInputs []string       `json:"referenceInputs"`
	Returns         []string       `json:"returns"`
}

CheckerTrace

type OutputObject

type OutputObject struct {
	Labels []string `json:"labels"`
	Object string   `json:"object"`
}

OutputObject ...

type Service

type Service struct {
}

func New

func New() *Service

func (*Service) AddFunds

func (s *Service) AddFunds(
	wallet Wallet, amount float64, sig string, mappings map[string]string, walletID string) (*sbacapi.Transaction, error)

AddFunds add new funds to a given wallet

func (*Service) AddFundsChecker

func (s *Service) AddFundsChecker(tr *CheckerTrace) bool

func (*Service) CreateWallet

func (s *Service) CreateWallet(address, pubkey, initobjID string, mappings map[string]string,
) (*sbacapi.Transaction, error)

CreateWallet Create a new Wallet from an address

func (*Service) CreateWalletChecker

func (s *Service) CreateWalletChecker(tr *CheckerTrace) bool

func (*Service) Init

func (s *Service) Init(addr string) string

Init create the seed object required to initialize the contract for a new wallet

func (*Service) TransferFunds

func (s *Service) TransferFunds(
	fromWallet, toWallet Wallet, amount float64, sig string, mappings map[string]string, fromWalletID, toWalletID string,
) (*sbacapi.Transaction, error)

TransferFunds transfer money from a wallet to another

func (*Service) TransferFundsChecker

func (s *Service) TransferFundsChecker(tr *CheckerTrace) bool

type Wallet

type Wallet struct {
	Address string  `json:"address"`
	Balance float64 `json:"balance"`
	PubKey  string  `json:"pubKey"`
}

Wallet the format of the wallet object stored in chainspace

Jump to

Keyboard shortcuts

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