// Returns the Address hash (what we use for inputs) given the public key func (w *SCWallet) GetAddressHash(address fct.IAddress) (fct.IAddress, error) { _, adr, err := w.getWalletEntry([]byte(fct.W_RCD_ADDRESS_HASH), address) if err != nil { return nil, err } return fct.CreateAddress(adr), nil }
func (w *SCWallet) AddECOutput(trans fct.ITransaction, address fct.IAddress, amount uint64) error { _, adr, err := w.getWalletEntry([]byte(fct.W_RCD_ADDRESS_HASH), address) if err != nil { adr = address } trans.AddECOutput(fct.CreateAddress(adr), amount) return nil }
func (w *SCWallet) AddInput(trans fct.ITransaction, address fct.IAddress, amount uint64) error { // Check if this is an address we know. we, adr, err := w.getWalletEntry([]byte(fct.W_RCD_ADDRESS_HASH), address) // If it isn't, we assume the user knows what they are doing. if we == nil || err != nil { rcd := fct.NewRCD_1(address.Bytes()) trans.AddRCD(rcd) adr, err := rcd.GetAddress() if err != nil { return err } trans.AddInput(fct.CreateAddress(adr), amount) } else { trans.AddRCD(we.GetRCD()) trans.AddInput(fct.CreateAddress(adr), amount) } return nil }