util

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRLPInput

func BuildRLPInput(address, currency string, value uint64) []byte

Build the RLP encoded input to the smart contract that deposit() will accept. The format of the UTXO inputs, outputs, and ownership data is critical. If any value is incorrect the deposit will be rejected by the smart contract and transaction reversed. The correct format is: [[[0,0,0],[0,0,0],[0,0,0],[0,0,0]],[[owner_public, eth_raw, 10], [eth_raw, eth_raw, 0], [eth_raw, eth_raw, 0], [eth_raw, eth_raw, 0]]] where eth_raw is 20 bytes of 0.

func ConvertStringToInt

func ConvertStringToInt(value string) int

func DeriveAddress

func DeriveAddress(p string) string

Derive Address from Private Key

func FilterZeroX

func FilterZeroX(item string) string

Filter our key string with 0x

func GenerateAccount

func GenerateAccount() (string, string)

Generate Account - Public and Privatekey

func LogFormatter

func LogFormatter()

Add the full time include timezone into log messages INFO[2019-01-31T16:38:57+07:00]

func RemoveLeadingZeroX

func RemoveLeadingZeroX(item string) string

Make strings suitable for hex encoding

func SendChChReq

func SendChChReq(
	chchRequest ChChRequester,
	chchClient string,
	method string,
	postData interface{},
) ([]byte, error)

func SignHash

func SignHash(hashed []byte, privateKeys []string) ([][]byte, error)

sign an already hashed tx bytes

Types

type ChChRequester

type ChChRequester interface {
	Do(req *http.Request) (*http.Response, error)
}

type DepositOwnership

type DepositOwnership struct {
	OwnerAddress common.Address
	Currency     common.Address
	Amount       uint64
}

type DepositParent

type DepositParent struct {
	UTXOInputs  []InputDeposit
	UTXOOutputs []interface{}
}

type InputDeposit

type InputDeposit struct {
	Txindex uint `json:"txindex"`
	Oindex  uint `json:"oindex"`
	Blknum  uint `json:"blknum"`
}

type OutputUTXO

type OutputUTXO struct {
	Currency1 common.Address
	Currency2 common.Address
	Value     uint
}

Jump to

Keyboard shortcuts

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