Skip to content

Refactor: replace @safe-global/safe-gateway-typescript-sdk imports #5500

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

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

compojoom
Copy link
Collaborator

What it solves

This is an attempt to refactor the code to use the new @safe-global/store package instead of @safe-global/safe-gateway-typescript-sdk.

The codemod is at the moment not complete.
I'm not sure how to map the data-decoded types and few other.

to execute the script one needs to have jscoodeshift installed globaly and then one can run

jscodeshift -t codemods/convert-safe-gateway-typescript-sdk.js apps/web/src --extensions=tsx --parser=tsx
jscodeshift -t codemods/convert-safe-gateway-typescript-sdk.js apps/web/src --extensions=ts --parser=ts

Prettier and lint are not happy with the newly generated code, so running those commands with --fix is necessary to reduce the amount of errors.

Resolves #

How this PR fixes it

How to test it

Screenshots

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

@compojoom compojoom force-pushed the refactor-safe-typescript-sdk branch from a6066c7 to 0633213 Compare March 25, 2025 10:41
Copy link

github-actions bot commented Mar 25, 2025

Branch preview

❌ Deploy failed!

Copy link

github-actions bot commented Mar 25, 2025

Coverage (25%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files25.432121.0125.75 
src0000 
   react-app-env.d.ts0000 
src/app0000 
   +html.tsx0100009–31
   +not-found.tsx0100008–21
   _layout.tsx000024–160
   accounts-sheet.tsx0100003–4
   action-details.tsx0100008
   address-book.tsx0100005
   app-settings.tsx0100005
   change-signer-sheet.tsx0100003–4
   confirm-transaction.tsx0100007–9
   confirmations-sheet.tsx0100003–4
   conflict-transaction-sheet.tsx0100003–4
   developer.tsx0100006
   get-started.tsx0100005
   index.tsx01000014
   networks-sheet.tsx0100003–4
   notifications-center.tsx0100005
   notifications-opt-in.tsx000010–30
   notifications-settings.tsx0100005
   onboarding.tsx0100005
   pending-transactions.tsx0100007
   share.tsx0100007–8
   transaction-actions.tsx0100008
   transaction-parameters.tsx0100008
src/app/(import-accounts)010000 
   _layout.tsx0100005–7
   form.tsx0100008–9
   index.tsx0100005
   signers.tsx0100008–9
src/app/(tabs)010000 
   _layout.tsx0100008–62
   index.tsx0100004–5
   settings.tsx0100004
src/app/(tabs)/transactions0000 
   _layout.tsx00007–26
src/app/(tabs)/transactions/(tabs)010000 
   _layout.tsx01000012–24
   index.tsx0100005
   messages.tsx01000010–34
src/app/import-signers010000 
   _layout.tsx0100005–7
   index.tsx01000015–60
   loading.tsx0100005
   private-key-error.tsx0100009–22
   private-key-success.tsx0100009–22
   private-key.tsx0100007–8
src/app/sign-transaction010000 
   _layout.tsx0100004
   index.tsx0100005
src/app/signers010000 
   [address].tsx0100006
   _layout.tsx0100006–15
   index.tsx0100007–9
src/components/Alert10085.71100100 
   Alert.tsx10085.7110010057, 72
   index.ts0000 
src/components/Badge87.57510087.5 
   Badge.tsx85.717510085.7149
   index.ts0000 
   theme.ts100100100100 
src/components/BlurredIdenticonBackground0000 
   BlurredIdenticonBackground.tsx000014–51
   index.tsx0000 
src/components/Camera0000 
   QrCamera.tsx00007–141
   index.ts0000 
src/components/ChainsDisplay10084.61100100 
   ChainsDisplay.tsx10084.6110010015–18
   index.ts0000 
src/components/Container10075100100 
   Container.tsx1007510010033
   index.ts0000 
src/components/CopyButton250025 
   CopyButton.tsx25002513–17
   index.ts0000 
src/components/DataRow100100100100 
   DataRow.tsx100100100100 
   index.ts0000 
src/components/Dropdown0000 
   DropdownLabel.tsx000015–27
   index.ts0000 
   sheetComponents.tsx0100008–42
src/components/EncodedData0000 
   EncodedData.tsx000010–12
   index.ts0000 
src/components/EthAddress10020100100 
   ETHAddress.tsx1002010010022–23
   index.ts0000 
src/components/Fiat10037.5100100 
   Fiat.tsx10037.510010022–34
   index.ts0000 
src/components/FloatingContainer0000 
   FloatingContainer.tsx000016–49
   index.ts0000 
src/components/Identicon100100100100 
   Identicon.tsx100100100100 
   index.ts0000 
src/components/InnerShadow100100100100 
   InnerShadow.tsx100100100100 
   index.ts0000 
src/components/LoadingScreen010000 
   LoadingScreen.tsx01000011
   index.ts0000 
src/components/Logo10087.5100100 
   Logo.tsx10087.510010034
   index.ts0000 
src/components/NetworkBadge33.33100033.33 
   NetworkBadge.tsx0100009–10
   index.ts0000 
   theme.ts100100100100 
src/components/OptIn0000 
   OptIn.tsx000026–81
   index.ts0000 
src/components/SafeBottomSheet0000 
   SafeBottomSheet.tsx000044–173
   index.ts0000 
src/components/SafeButton60066.6660 
   SafeButton.tsx60066.666067–68
   index.ts0000 
src/components/SafeCard100100100100 
   SafeCard.tsx100100100100 
   index.ts0000 
src/components/SafeFontIcon87.585.7110087.5 
   SafeFontIcon.tsx87.585.7110087.528
   index.ts0000 
src/components/SafeInput8073.337580 
   SafeInput.tsx10077.7710010044–57
   SafeInputWithLabel.tsx000014–63
   index.ts0000 
   styled.ts100100100100 
   theme.ts100100100100 
   utils.ts100100100100 
src/components/SafeListItem10073.68100100 
   SafeListItem.tsx10073.6810010077–91
   index.tsx0000 
   theme.ts100100100100 
src/components/SafeSearchBar0000 
   SafeSearchBar.tsx000011–74
src/components/SafeTab28.570030 
   SafeTab.tsx44.44100044.4414–27
   SafeTabBar.tsx9.09001018–45
   index.tsx0000 
   theme.ts100100100100 
   types.ts0000 
src/components/StatusBanners/PendingTransactions10050100100 
   PendingTransactions.tsx1005010010017
   index.tsx0000 
src/components/Tab0000 
   TabNameContext.tsx00003–10
src/components/Tag01001000 
   Tag.tsx010010003
   index.ts0000 
src/components/Title10066.66100100 
   LargeHeaderTitle.tsx100100100100 
   NavBarTitle.tsx100100100100 
   SectionTitle.tsx10066.6610010011
   index.ts0000 
src/components/TxInfo254.1633.3325 
   TxInfo.tsx254.1633.332536–37, 57–143, 147
   index.tsx0000 
   types.ts0000 
src/components/navigation100100100100 
   TabBarIcon.tsx100100100100 
   index.ts0000 
src/components/transactions-list/Card/AccountCard10083.33100100 
   AccountCard.tsx10083.3310010058
   index.ts0000 
src/components/transactions-list/Card/AssetsCard100100100100 
   AssetsCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/SignersCard10071.42100100 
   SignersCard.tsx10071.4210010030, 44
   index.ts0000 
src/components/transactions-list/Card/TxBatchCard100100100100 
   TxBatchCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxConflictingCard0000 
   TxConflictingCard.tsx000015–46
   index.tsx0000 
src/components/transactions-list/Card/TxContractInteractionCard100100100100 
   TxContractInteractionCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxCreationCard100100100100 
   TxCreationCard.tsx100100100100 
   index.ts0000 
src/components/transactions-list/Card/TxGroupedCard90.9757590.9 
   TxGroupedCard.tsx90.9757590.957
   index.tsx0000 
src/components/transactions-list/Card/TxRejectionCard100100100100 
   TxRejectionCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxSafeAppCard100100100100 
   TxSafeAppCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxSettingsCard80505080 
   TxSettingsCard.tsx8050508021
   index.tsx0000 
src/components/transactions-list/Card/TxSwapCard100100100100 
   TxSwapCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxTokenCard10091.66100100 
   TxTokenCard.tsx10091.6610010023
   index.tsx0000 
src/config5087.5050 
   constants.ts10087.510010015
   ethers.ts01000010–38
   polyfills.ts0000 
src/context0000 
   NotificationsContext.tsx00009–26
src/features/AccountsSheet0000 
   AccountsSheet.container.tsx000010–23
   index.tsx0000 
src/features/AccountsSheet/AccountItem81.257566.6680 
   AccountItem.tsx81.257566.668026, 43–52
   index.ts0000 
src/features/AccountsSheet/AccountItem/hooks47.05033.3350 
   useEditAccountItem.ts47.05033.335019–44
src/features/AccountsSheet/MyAccounts93.3310080100 
   MyAccounts.container.tsx100100100100 
   MyAccountsFooter.tsx8010050100 
   index.ts0000 
src/features/AccountsSheet/MyAccounts/hooks41.661004045.45 
   useMyAccounts.ts100100100100 
   useMyAccountsSortable.ts01000011–30
src/features/ActionDetails0000 
   ActionDetails.container.tsx000015–36
   ActionsDetails.tsx00009–11
   index.ts0000 
   utils.tsx000016–112
src/features/AddressBook010000 
   AddressBook.container.tsx0100007–10
   index.tsx0000 
src/features/AddressBook/components0000 
   AddressBookView.tsx000014–42
src/features/AddressBook/components/List0000 
   AddressBookList.tsx000021–75
   AddressBookListHeader.tsx000010
   EmptyAddressBookDark.tsx0100005
   EmptyAddressBookLight.tsx0100005
   NoContacts.tsx00007–12
   index.ts0000 
src/features/Assets010000 
   Assets.container.tsx0100009–21
   index.tsx0000 
   styles.ts010010003
src/features/Assets/components/AssetsHeader0000 
   AssetsHeader.container.tsx0100006–13
   AssetsHeader.tsx000015
   index.tsx0000 
   styles.ts010010003
src/features/Assets/components/Balance0000 
   Balance.container.tsx000016–41
   Balance.tsx000035–49
   ChainItems.tsx000017–28
   index.tsx0000 
src/features/Assets/components/Fallback10025100100 
   Fallback.tsx1002510010017–19
   index.ts0000 
src/features/Assets/components/NFTs10075100100 
   NFTItem.tsx100501001008
   NFTs.container.tsx1008010010027, 52
   index.tsx0000 
src/features/Assets/components/Navbar7.14007.14 
   Navbar.tsx000015–50
   index.tsx0000 
   theme.ts100100100100 
src/features/Assets/components/NoFunds10050100100 
   EmptyNFT.tsx1005010010010
   EmptyToken.tsx100100100100 
   NoFunds.tsx100100100100 
   index.ts0000 
src/features/Assets/components/Tokens10077.77100100 
   Tokens.container.tsx10077.7710010022–45
   index.tsx0000 
src/features/ChangeSignerSheet0000 
   ChangeSignerSheet.container.tsx000022–74
   index.ts0000 
src/features/ConfirmTx0000 
   ConfirmTx.container.tsx000019–51
   index.ts0000 
   utils.ts00004–15
src/features/ConfirmTx/components/ConfirmTxForm0000 
   ConfirmTxForm.tsx000023–43
   index.ts0000 
src/features/ConfirmTx/components/ConfirmationView0000 
   ConfirmationView.tsx000026–76
   index.ts0000 
   types.ts0000 
src/features/ConfirmTx/components/ExecuteForm010000 
   ExecuteForm.tsx01000014–16
   index.ts0000 
src/features/ConfirmTx/components/ListTable0000 
   ListTable.tsx000018–21
   index.ts0000 
src/features/ConfirmTx/components/LoadingTx010000 
   LoadingTx.tsx0100006
   index.ts0000 
src/features/ConfirmTx/components/ParametersButton010000 
   ParametersButton.tsx01000010–17
   index.ts0000 
src/features/ConfirmTx/components/SignForm0000 
   SignForm.tsx000018–25
   index.ts0000 
src/features/ConfirmTx/components/SignTransaction0000 
   SignError.tsx01000013–60
   SignSuccess.tsx01000016–59
   SignTransaction.tsx000017–61
   index.ts0000 
src/features/ConfirmTx/components/TransactionHeader0000 
   TransactionHeader.tsx000031–34
   index.tsx0000 
src/features/ConfirmTx/components/TransactionInfo0000 
   TransactionInfo.tsx000017–28
   index.ts0000 
src/features/ConfirmTx/components/confirmation-views/AddSigner0000 
   AddSigner.tsx01000022–30
   index.ts0000 
   utils.tsx000013–63
src/features/ConfirmTx/components/confirmation-views/AlreadySigned010000 
   AlreadySigned.tsx0100006
   index.ts0000 
src/features/ConfirmTx/components/confirmation-views/Contract0000 
   Contract.tsx000024–35
   index.ts0000 
   utils.tsx000012–44
src/features/ConfirmTx/components/confirmation-views/GenericView0000 
   GenericView.tsx000029–36
   index.ts0000 
   utils.tsx000018–94
src/features/ConfirmTx/components/confirmation-views/RemoveSigner010000 
   RemoveSigner.tsx01000024–29
   index.ts0000 
   utils.tsx01000012–30
src/features/ConfirmTx/components/confirmation-views/SendNFT0000 
   SendNFT.tsx01000020–25
   index.ts0000 
   utils.tsx000011–29
src/features/ConfirmTx/components/confirmation-views/Stake010000 
   Stake.tsx0100007–14
   index.ts0000 
   utils.tsx0100007–61
src/features/ConfirmTx/components/confirmation-views/SwapOrder0000 
   SwapOrder.tsx01000018–23
   SwapOrderHeader.tsx01000018–25
   index.ts0000 
   utils.tsx000014–54
src/features/ConfirmTx/components/confirmation-views/TokenTransfer0000 
   TokenTransfer.tsx000028–73
   index.ts0000 
src/features/ConfirmTx/hooks/useTxSigner0000 
   index.ts0000 
   useTxSigner.ts000010–53
src/features/ConfirmationsSheet0000 
   ConfirmationsSheet.container.tsx000019–95
   index.ts0000 
src/features/ConflictTxSheet010000 
   ConflictTxSheet.container.tsx0100006–7
   index.ts0000 
src/features/Developer0000 
   Developer.container.tsx00009–33
   index.tsx0000 
   types.ts0000 
src/features/Developer/components010000 
   Developer.tsx01000012–33
src/features/GetStarted010000 
   GetStarted.tsx01000011–34
   index.tsx0000 
src/features/ImportPrivateKey100100100100 
   ImportPrivateKey.container.tsx100100100100 
   index.ts0000 
src/features/ImportPrivateKey/components/ImportError010000 
   ImportError.tsx01000012–14
   index.ts0000 
src/features/ImportPrivateKey/components/ImportSuccess0000 
   ImportSuccess.tsx000017–71
   index.ts0000 
src/features/ImportPrivateKey/components/LoadingImport0000 
   LoadingImport.container.tsx000019–130
   index.ts0000 
src/features/ImportPrivateKey/hooks66.66507566.66 
   useImportPrivateKey.ts66.66507566.6618–19, 30–39, 44–45
src/features/ImportReadOnly0000 
   AddSignersForm.container.tsx000017–65
   ImportAccountForm.container.tsx000015–66
   NetworkBadge.container.tsx00009–15
   ScanQrAccount.container.tsx000010–68
   index.tsx0000 
   schema.ts0100005–12
   types.ts0000 
src/features/ImportReadOnly/components0000 
   AddSignersFormView.tsx01000014–20
   AvailableNetworks.tsx0100006–11
   ImportAccountFormView.tsx000032–92
   ScanQrAccountView.tsx000016–17
   VerificationStatus.tsx000012–26
src/features/ImportReadOnly/helpers100100100100 
   safes.tsx100100100100 
src/features/NetworksSheet0000 
   NetworksSheet.container.tsx000016–47
   index.tsx0000 
src/features/Notifications010000 
   NotificationsCenter.container.tsx0100004–5
   NotificationsSettings.container.tsx0100006–9
   index.tsx0000 
src/features/Notifications/components0000 
   EmptyBell.tsx0100005
   NotificationPermissions.tsx000011–14
   NotificationsScreenEmpty.tsx0100006–7
   NotificationsSettingsView.tsx000028–76
src/features/Onboarding100100100100 
   Onboarding.container.tsx100100100100 
   index.ts0000 
src/features/Onboarding/components/OnboardingCarousel9688.8888.8896 
   CarouselFeedback.tsx100100100100 
   CarouselItem.tsx1008010010031
   OnboardingCarousel.tsx91.6610083.3391.6650
   index.ts0000 
   items.tsx100100100100 
src/features/Onboarding/components/OnboardingHeader100100100100 
   OnboardingHeader.tsx100100100100 
   index.ts0000 
src/features/PendingTx0000 
   PendingTx.container.tsx0100006–8
   index.tsx0000 
   utils.tsx000024–170
src/features/PendingTx/components/PendingTxList0000 
   PendingTxList.container.tsx000033–63
   index.ts0000 
src/features/Settings0000 
   Settings.container.tsx00009–25
   Settings.tsx000024–170
   index.tsx0000 
src/features/Settings/components/AppSettings0000 
   AppSettings.container.tsx00007–23
   AppSettings.tsx01000010–11
   index.ts0000 
src/features/Settings/components/IdenticonWithBadge10050100100 
   IdenticonWithBadge.tsx1005010010021–22
   index.ts0000 
src/features/Settings/components/Navbar0000 
   Navbar.tsx0100007–11
   SettingsButton.tsx0100006–15
   SettingsMenu.tsx000021–95
   index.ts0000 
src/features/Share0000 
   Share.container.tsx00008–14
   index.ts0000 
src/features/Share/components100100100100 
   ShareView.tsx100100100100 
   index.ts0000 
src/features/Signer0000 
   Signer.container.tsx000016–99
   index.ts0000 
   schema.ts010010003
   types.ts0000 
src/features/Signer/components0000 
   SignerView.tsx000025–52
src/features/Signers0000 
   Signers.container.tsx000010–26
   constants.ts010010003
   index.tsx0000 
src/features/Signers/components/SignersList0000 
   SignersList.tsx000020–59
   SignersListHeader.tsx000012
   SignersListItem.tsx000023–60
   index.ts0000 
src/features/Signers/components/SignersList/hooks010000 
   useSignersActions.ts0100005–41
src/features/Signers/hooks0000 
   useSignersGroupService.ts000011–34
src/features/TransactionActions0000 
   TransactionActions.container.tsx000015–35
   index.ts0000 
src/features/TransactionActions/components0000 
   TxActionsList.tsx000015–55
src/features/TransactionParameters0000 
   TransactionParameters.container.tsx000015–35
   index.ts0000 
src/features/TransactionParameters/components/TxParametersList0000 
   TxParametersList.tsx01000013–15
   index.ts0000 
   utils.tsx000014–63
src/features/TransactionParameters/components/TxParametersList/formatters0000 
   arrayValue.tsx00008–31
   singleValue.tsx000010–51
src/features/TxHistory0000 
   TxHistory.container.tsx000010–36
   index.tsx0000 
   utils.tsx000018–58
src/features/TxHistory/components/TxHistoryList0000 
   TxHistoryList.tsx000018–33
   index.ts0000 
src/hooks16.6611.8425.7116.52 
   useGTW.ts000022–140
   useNotificationGTWPermissions.ts76.9283.336081.8114–15
   useNotificationManager.ts40.813.335040.8123–26, 39–47, 52–63, 68–76, 82–89
   useNotificationPayload.ts81.817510081.8124–25
   useRegisterForNotifications.ts000038–329
   useSiwe.ts01000013–32
src/hooks/services100100100100 
   useSafeOverviewService.ts100100100100 
src/hooks/useCopyAndDispatchToast100100100100 
   index.ts100100100100 
src/hooks/useInfiniteScroll72.2262.58072.22 
   index.ts0000 
   useInfiniteScroll.ts72.2262.58072.2228, 39–44
src/hooks/useMakeSafesWithChainId010000 
   useMakeSafesWithChainId.ts0100007–12
src/hooks/usePendingTxs0000 
   index.ts000014–41
src/hooks/usePreventLeaveScreen010000 
   index.ts0100005–17
src/hooks/useSign78.9412.510078.94 
   index.ts0000 
   useSign.ts78.9412.510078.9443–46, 60–63
src/hooks/useTokenDetails81.8173.0710081.81 
   index.ts0000 
   useTokenDetails.ts81.8173.0710081.8122, 52
src/hooks/useTransactionType91.6679.1610091.66 
   index.tsx91.6679.1610091.66116–124
src/navigation0000 
   NavigationGuardHOC.tsx00009–69
   useScrollableHeader.tsx000023–48
src/navigation/hooks0000 
   useModalStyle.ts000013–28
   utils.tsx0100006–17
src/services/exceptions88.8810010088.88 
   utils.ts88.8810010088.8814
src/services/key-storage6.66006.66 
   index.ts100100100100 
   key-storage.service.ts2.7002.731–115
   types.ts0000 
   wallet.service.ts000010–18
src/services/notifications0000 
   FCMService.ts000012–77
   NotificationService.ts000025–301
src/services/tx0000 
   extractTx.ts00007–111
src/services/tx/tx-sender0000 
   create.ts000016–26
   index.ts0000 
   sign.ts000014–52
src/services/web318.180018.18 
   index.ts18.180018.187–12, 20–27, 31, 42–62
src/store42.515.5519.7144.08 
   activeSafeSlice.ts6005055.5515–24
   activeSignerSlice.ts36.3610004014–20, 28–29
   addressBookSlice.ts3012.527.272525–65, 76–79
   constants.ts66.660066.66350–363
   delegatedSlice.ts44.44005028–33
   index.ts92.35010092.362
   myAccountsSlice.ts71.4210033.3366.6613–16
   notificationsSlice.ts39.130052.9418–36
   safesSlice.ts31.5710011.1131.2520–38, 47–48
   settingsSlice.ts71.4210033.3383.3321
   signersBalance.ts31.2502035.7117–33
   signersSlice.ts38.460045.4514–16, 23–28
   storage.ts7.14007.1412–67
   txHistorySlice.ts100100100100 
src/store/chains60.8612.533.3370 
   index.ts60.8612.533.337010, 23, 28, 41–45
src/store/hooks85.715010085.71 
   activeSafe.ts8050100808
   index.ts100100100100 
src/theme100100100100 
   navigation.ts100100100100 
   tamagui.config.ts100100100100 
   tokens.ts100100100100 
src/theme/helpers10081.81100100 
   utils.ts10081.8110010037, 41
src/theme/hooks010000 
   useSafeAreaPaddingBottom.tsx0100004–6
src/theme/palettes100100100100 
   darkPalette.ts100100100100 
   lightPalette.ts100100100100 
src/theme/provider59.0927.776059.09 
   font.tsx90501009034
   safeTheme.tsx10037.510010019–34
   toastProvider.tsx000010–29
src/utils61.293257.3761.01 
   balance.ts100100100100 
   chains.ts100100100100 
   date.ts9666.6685.7110031, 35–39
   formatters.ts57.8957.1457.1455.5510, 21, 34–41, 45–48
   logger.ts56.0924505524, 32, 40–45, 50–55, 61–66, 85
   transaction-guards.ts74.642.8556.6677.0455, 59–65, 76, 80, 84, 106, 121, 125, 139, 143
   transactions.tsx000014–67
src/utils/notifications010000 
   index.ts01000016–55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant