// Runs an individual nametx. func registerNameTx(name *definitions.RegisterName, do *definitions.Do) (string, error) { // Process Variables name.Source, _ = util.PreProcess(name.Source, do) name.Name, _ = util.PreProcess(name.Name, do) name.Data, _ = util.PreProcess(name.Data, do) name.Amount, _ = util.PreProcess(name.Amount, do) name.Fee, _ = util.PreProcess(name.Fee, do) // Set Defaults name.Source = useDefault(name.Source, do.Package.Account) name.Fee = useDefault(name.Fee, do.DefaultFee) name.Amount = useDefault(name.Amount, do.DefaultAmount) // Don't use pubKey if account override var oldKey string if name.Source != do.Package.Account { oldKey = do.PublicKey do.PublicKey = "" } // Formulate tx log.WithFields(log.Fields{ "name": name.Name, "data": name.Data, "amount": name.Amount, }).Info("NameReg Transaction") erisNodeClient := client.NewErisNodeClient(do.Chain) erisKeyClient := keys.NewErisKeyClient(do.Signer) tx, err := core.Name(erisNodeClient, erisKeyClient, do.PublicKey, name.Source, name.Amount, name.Nonce, name.Fee, name.Name, name.Data) if err != nil { return util.MintChainErrorHandler(do, err) } // Don't use pubKey if account override if name.Source != do.Package.Account { do.PublicKey = oldKey } // Sign, broadcast, display return txFinalize(do, tx, name.Wait) }
// Runs an individual nametx. func registerNameTx(name *definitions.RegisterName, do *definitions.Do) (string, error) { // Process Variables name.Source, _ = util.PreProcess(name.Source, do) name.Name, _ = util.PreProcess(name.Name, do) name.Data, _ = util.PreProcess(name.Data, do) name.Amount, _ = util.PreProcess(name.Amount, do) name.Fee, _ = util.PreProcess(name.Fee, do) // Set Defaults name.Source = useDefault(name.Source, do.Package.Account) name.Fee = useDefault(name.Fee, do.DefaultFee) name.Amount = useDefault(name.Amount, do.DefaultAmount) // Don't use pubKey if account override var oldKey string if name.Source != do.Package.Account { oldKey = do.PublicKey do.PublicKey = "" } // Formulate tx logger.Infof("NameReg Transaction =>\t\t%s:%s:%s\n", name.Name, name.Data, name.Amount) tx, err := core.Name(do.Chain, do.Signer, do.PublicKey, name.Source, name.Amount, name.Nonce, name.Fee, name.Name, name.Data) if err != nil { logger.Errorf("ERROR =>\n") return "", err } // Don't use pubKey if account override if name.Source != do.Package.Account { do.PublicKey = oldKey } // Sign, broadcast, display return txFinalize(do, tx, name.Wait) }