Looking for a good approach for transaction fee payment #403
Replies: 3 comments 3 replies
-
W.r.t those two points, I think we should have defaults but also provide an interface to configure these values and override the default -- kinda like we're already doing with some configurations.
This makes sense to me! |
Beta Was this translation helpful? Give feedback.
-
The tools sound useful. I think this may be a common issue when wanting to show a preview of all these values to the end user. For instance I was trying to transfer a coin between wallets with some equivalent USD value of like $0.50, but the fee ended up being $7.35! So I opted just to keep it in the first wallet 😒
Yes this should be an overridable option and default to sensible percentage. 20% seems fine (I don't have any stats), though maybe 5-10% is more realistic?
I feel like this would be something they'd want returned - does the TX automatically fail if they are too low? Assuming a user doesn't know what any values of the three are, then they'd want an easy way to get all three in one function invocation. See question 1. |
Beta Was this translation helpful? Give feedback.
-
Just a heads up, we do have calculateFee on the transaction request and it returns |
Beta Was this translation helpful? Give feedback.
-
WIP: #400
Introduction
I'm currently working on enabling users from the TS SDK, to query
transaction cost and better set
gasLimit
.For now, we take the path of giving the tools for the user to get the transaction cost,
but not make it automatically.
Context
Today the best way to measure
gasUsed
is by executing a transaction ondryRun
mode,with
utxoValidation
false, against a valid online provider. This returns an approximation for the gas to be consumed onthe real transaction.
With the
gasUsed
returned we need to apply atolerance margin
to avoid cases where the future submissionof the tx can use a bit more gas, like a concurrently state change on the contract.
Use cases
Use case 1:
The user creates a contract call without adding
txParams
.In this case, the txParams are going to be the default SDK values;
Note: If the node requires
gasPrice
andbytePrice
to be bigger than0
it will failUse case 2:
The user creates a contract call and sets
gasPrice
andbytePrice
.In this case, the txParams set by the user are going to be overridden;
Note: If the node requires
gasPrice
andbytePrice
to be bigger than1
it will fail.Use case 3:
The user creates a contract call and wants to have control of the
gasLimit
;Important points
gasUsed
.Questions
gasLimit
? Or we should just provide the tools?bytePrice
andgasPrice
are lower than the node requirement?Beta Was this translation helpful? Give feedback.
All reactions