-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(wallet)!: allowing client to set custom values for fees, nonce, gas #6124
base: develop
Are you sure you want to change the base?
Conversation
Looks like you have BREAKING CHANGES in your PR. Check-list
|
Jenkins BuildsClick to see older builds (24)
|
@@ -55,6 +55,9 @@ type RouteInputParams struct { | |||
PublicKey string `json:"publicKey"` | |||
PackID *hexutil.Big `json:"packID"` | |||
|
|||
// Used internally | |||
PathTxCustomParams map[string]*PathTxCustomParams `json:"-"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if used internally it could be lower case?
that way it won't even be exported in json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It cannot cause it's a different package. So either this or to have a function that will set this property, but more or less the same thing.
RouterInputParamsUuid string `json:"routerInputParamsUuid" validate:"required"` | ||
PathName string `json:"pathName" validate:"required"` | ||
ChainID uint64 `json:"chainID" validate:"required"` | ||
ApprovalTx bool `json:"approvalTx"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: IsApprovalTx
@@ -50,23 +56,28 @@ type SuggestedFeesGwei struct { | |||
MaxFeePerGasLow *big.Float `json:"maxFeePerGasLow"` | |||
MaxFeePerGasMedium *big.Float `json:"maxFeePerGasMedium"` | |||
MaxFeePerGasHigh *big.Float `json:"maxFeePerGasHigh"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we adjust our various fees level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you mean this? To have a new formula for each?
This is what we have now:
{
Low: (*hexutil.Big)(new(big.Int).Add(baseFee, maxPriorityFeePerGas)),
Medium: (*hexutil.Big)(new(big.Int).Add(new(big.Int).Mul(baseFee, big.NewInt(2)), maxPriorityFeePerGas)),
High: (*hexutil.Big)(new(big.Int).Add(new(big.Int).Mul(baseFee, big.NewInt(3)), maxPriorityFeePerGas)),
}
Let me know if you want to change the equation and to what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest: high to be 2x base fee and medium to be 1.2 base fee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return r.setCustomTxDetails(pathTxIdentity, &requests.PathTxCustomParams{GasFeeMode: feeMode}) | ||
} | ||
|
||
func (r *Router) SetCustomTxDetails(ctx context.Context, pathTxIdentity *requests.PathTxIdentity, pathTxCustomParams *requests.PathTxCustomParams) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we find a better name for the private function? IMO a bit unclear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am open to suggestions, but it's not private, it's exposed via API.
There are 2 new functions that we're exposing, mentioned in the description of this PR, under "New endpoints added:" section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this one is not private but there is also setCustomTxDetails
so 2 functions with same name one private, on public
I didn't suggest cause nothing comes to mind but ... there is probably a better naming
38e658a
to
f15bd8c
Compare
f15bd8c
to
011767c
Compare
Removed properties from `Path` type: - `MaxFeesPerGas`, based on the sending flow progress appropriate new properties (`TxMaxFeesPerGas`, `ApprovalMaxFeesPerGas`) should be used Added new properties to `Path` type: - `RouterInputParamsUuid`, used to identify from which router input params this path was created - `TxNonce`, used to set nonce for the tx - `TxMaxFeesPerGas`, used to set max fees per gas for the tx - `TxEstimatedTime`, used to estimate time for executing the tx - `ApprovalTxNonce`, used to set nonce for the approval tx - `ApprovalTxMaxFeesPerGas`, used to set max fees per gas for the approval tx - `ApprovalTxEstimatedTime`, used to estimate time for executing the approval tx New request types added: - `PathTxCustomParams`, used to pass tx custom params from the client - `PathTxIdentity`, used to uniquely identify path (tx) to which the custom params need to be applied New endpoints added: - `SetFeeMode` used to set fee mode (`GasFeeLow`, `GasFeeMedium` or `GasFeeHigh`) - `SetCustomTxDetails` used to set custom fee mode (`SetCustomTxDetails`), if this mode is set, client needs to provide: - Max fees per gas - Max priority fee - Nonce - Gas amount
011767c
to
aae6e8b
Compare
Removed properties from
Path
type:MaxFeesPerGas
, based on the sending flow progress appropriate new properties (TxMaxFeesPerGas
,ApprovalMaxFeesPerGas
) should be usedAdded new properties to
Path
type:RouterInputParamsUuid
, used to identify from which router input params this path was createdTxNonce
, used to set nonce for the txTxMaxFeesPerGas
, used to set max fees per gas for the txTxEstimatedTime
, used to estimate time for executing the txApprovalTxNonce
, used to set nonce for the approval txApprovalTxMaxFeesPerGas
, used to set max fees per gas for the approval txApprovalTxEstimatedTime
, used to estimate time for executing the approval txNew request types added:
PathTxCustomParams
, used to pass tx custom params from the clientPathTxIdentity
, used to uniquely identify the path (tx) to which the custom params need to be appliedNew endpoints added:
SetFeeMode
, used to set fee mode (GasFeeLow
,GasFeeMedium
orGasFeeHigh
)SetCustomTxDetails
, used to set custom fee mode (SetCustomTxDetails
), if this mode is set, the client needs to provide:Closes #6109
Closes backed part for