Exemple #1
0
func _gaddr_a1(S []cipher.SecKey) []cipher.Address {
	A := make([]cipher.Address, len(S))
	for i := 0; i < len(S); i++ {
		A[i] = cipher.AddressFromSecKey(S[i])
	}
	return A
}
Exemple #2
0
func WalletEntryFromReadable(w *ReadableWalletEntry) WalletEntry {
	// SimpleWallet entries are shared as a form of identification, the secret key
	// is not required
	// TODO -- fix lib/base58 to not panic on invalid input -- should
	// return error, so we can detect a broken wallet.

	if w.Address == "" {
		//log.Panic("ReadableWalletEntry has no Address")
	}
	var s cipher.SecKey
	if w.Secret != "" {
		s = cipher.MustSecKeyFromHex(w.Secret)
	}

	//regen from the private key
	//redundant/
	if w.Address == "" {
		addr := cipher.AddressFromSecKey(s)
		pub := cipher.PubKeyFromSecKey(s)

		return WalletEntry{
			Address: addr,
			Public:  pub,
			Secret:  s,
		}
	}

	return WalletEntry{
		Address: cipher.MustDecodeBase58Address(w.Address),
		Public:  cipher.MustPubKeyFromHex(w.Public),
		Secret:  s,
	}
}
Exemple #3
0
func _gaddr(s cipher.SecKey) cipher.Address {
	return cipher.AddressFromSecKey(s)
}