Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Add gas estimation endpoint from gateway SDK #2725

Merged
merged 4 commits into from
Sep 16, 2021

Conversation

dasanra
Copy link
Collaborator

@dasanra dasanra commented Sep 14, 2021

What it solves

Resolves safe-global/safe-gateway-typescript-sdk#14

How this PR fixes it

Uses new function in the gateway SDK in order to estimate safeTxGas

Bonus

It also uses the function to fetch owned safes through the client gateway instead transaction service

How to test

  • Check that safeTxGas estimations are still correct
  • Check that owned safes are shown in sidebar correctly

@dasanra dasanra added the WIP label Sep 14, 2021
@dasanra dasanra self-assigned this Sep 14, 2021
@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@@ -162,7 +162,7 @@ export const ReviewConfirm = ({
origin: app.id,
navigateToTransactionsTab: false,
txNonce: txParameters.safeNonce,
safeTxGas: txParameters.safeTxGas ? txParameters.safeTxGas : undefined,
safeTxGas: txParameters.safeTxGas,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we were casting to Number here. This value can only be string or undefined so no need for ternary check here, if value is already undefined we can safely return the value

@github-actions
Copy link

github-actions bot commented Sep 14, 2021

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@github-actions
Copy link

@github-actions
Copy link

@github-actions
Copy link

@github-actions
Copy link

E2E Tests Passed
Check the results here: https://github.com/gnosis/safe-react-e2e-tests/actions/runs/1233133114

Use fetchSafesByOwner from client-gateway
@dasanra dasanra removed the WIP label Sep 15, 2021
const url = `${getTxServiceUrl()}/owners/${ownerAddress}/safes`
const res = await axios.get<{ safes: string[] }>(url)
return res.data.safes
return getOwnedSafes(getClientGatewayUrl(), getNetworkId().toString(), checksumAddress(ownerAddress)).then(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks! This was a heavy request!

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@github-actions
Copy link

E2E Tests Passed
Check the results here: https://github.com/gnosis/safe-react-e2e-tests/actions/runs/1237314460

@github-actions
Copy link

E2E Tests Passed
Check the results here: https://github.com/gnosis/safe-react-e2e-tests/actions/runs/1237350276

@francovenica
Copy link
Contributor

I tried in rinkeby and I had no issues, with safes with 2 owners and 1 owner needed. The safeTxGas estimation looked fine, I was able to execute tx with the default estimation just fine

I tried in Polygon and it worked a bit, but it seems the network is slow today so some tx didn't even trigger signatures. I'll try that one later, but the tx I was able to execute worked just fine

@francovenica
Copy link
Contributor

Polygon is still a bit slow on how it is working, but the tx I signed the safeTxGas was estimated properly.

@dasanra dasanra merged commit 35ca789 into dev Sep 16, 2021
@dasanra dasanra deleted the feature/add-gas-estimation-endpoint branch September 16, 2021 13:33
@github-actions github-actions bot locked and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add gas estimation endpoint
3 participants