Ejemplo n.º 1
0
func mustMakeUtxoOutput(addr string, amount uint64, hours uint64) coin.TransactionOutput {
	uo := coin.TransactionOutput{}
	uo.Address = cipher.MustDecodeBase58Address(addr)
	uo.Coins = amount
	uo.Hours = hours
	return uo
}
Ejemplo n.º 2
0
func NewReadableTransactionOutput(t *coin.TransactionOutput, txid cipher.SHA256) ReadableTransactionOutput {
	return ReadableTransactionOutput{
		Hash:    t.UxId(txid).Hex(),
		Address: t.Address.String(), //Destination Address
		Coins:   StrBalance(t.Coins),
		Hours:   t.Hours,
	}
}
Ejemplo n.º 3
0
func TransactionOutputFromJSON(in TransactionOutputJSON) (coin.TransactionOutput, error) {
	var tx coin.TransactionOutput

	//hash, err := cipher.SHA256FromHex(in.Hash)
	//if err != nil {
	//	return coin.TransactionOutput{}, errors.New("Invalid hash")
	//}
	addr, err := cipher.DecodeBase58Address(in.Address)
	if err != nil {
		return coin.TransactionOutput{}, errors.New("Adress decode fail")
	}
	//tx.Hash = hash
	tx.Address = addr
	tx.Coins = in.Coins
	tx.Hours = in.Hours

	return tx, nil
}