Git Product home page Git Product logo

Comments (4)

feelancer21 avatar feelancer21 commented on June 4, 2024 1

how about this?

It is not exactly the same. For lnrpc.EstimateFee you have to provice adresses in a json string to get the feerate. It's fine for the usecase of estimating the exact fee in satoshis for a transaction. If you only like to know the current onchain feerate you don't need the overhead of providing the json string.

from lnd.

guggero avatar guggero commented on June 4, 2024 1

Maybe the new command should therefore be called estimatefeerate to distinguish better between the two use cases?

from lnd.

Chinwendu20 avatar Chinwendu20 commented on June 4, 2024

how about this?

lnd/cmd/lncli/commands.go

Lines 212 to 268 in 399ea86

var estimateFeeCommand = cli.Command{
Name: "estimatefee",
Category: "On-chain",
Usage: "Get fee estimates for sending bitcoin on-chain to multiple addresses.",
ArgsUsage: "send-json-string [--conf_target=N]",
Description: `
Get fee estimates for sending a transaction paying the specified amount(s) to the passed address(es).
The send-json-string' param decodes addresses and the amount to send respectively in the following format:
'{"ExampleAddr": NumCoinsInSatoshis, "SecondAddr": NumCoins}'
`,
Flags: []cli.Flag{
cli.Int64Flag{
Name: "conf_target",
Usage: "(optional) the number of blocks that the " +
"transaction *should* confirm in",
},
coinSelectionStrategyFlag,
},
Action: actionDecorator(estimateFees),
}
func estimateFees(ctx *cli.Context) error {
ctxc := getContext()
var amountToAddr map[string]int64
jsonMap := ctx.Args().First()
if err := json.Unmarshal([]byte(jsonMap), &amountToAddr); err != nil {
return err
}
coinSelectionStrategy, err := parseCoinSelectionStrategy(ctx)
if err != nil {
return err
}
client, cleanUp := getClient(ctx)
defer cleanUp()
resp, err := client.EstimateFee(ctxc, &lnrpc.EstimateFeeRequest{
AddrToAmount: amountToAddr,
TargetConf: int32(ctx.Int64("conf_target")),
CoinSelectionStrategy: coinSelectionStrategy,
})
if err != nil {
return err
}
printRespJSON(resp)
return nil
}
var txLabelFlag = cli.StringFlag{
Name: "label",
Usage: "(optional) a label for the transaction",
}

from lnd.

feelancer21 avatar feelancer21 commented on June 4, 2024

Maybe the new command should therefore be called estimatefeerate to distinguish better between the two use cases?

Made a PR yesterday. Named it estimatefee too but placed it as subcommand for wallet, because it calls walletrpc. But now there are two cli.commands with the same name. Not really sure if there are unseen side effects.

But maybe better to discuss it here.
#8730

from lnd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.