Skip to content
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: Hooks to update Safe threshold + owners #13

Merged
merged 29 commits into from
Oct 9, 2024

Conversation

tmjssz
Copy link
Contributor

@tmjssz tmjssz commented Sep 27, 2024

Resolves: Issue #5

This pull request introduces new functionality to manage a Safe's threshold and owners by adding the following hooks:

New Hooks

1.useUpdateThreshold

Hook to update the threshold of the connected Safe.

2. useUpdateOwners

Hook to manage the owners of the connected Safe, including adding, removing, or swapping owners. This hook internally uses:

  • useAddOwner: Adds a new owner to the Safe.
  • useRemoveOwner: Removes an existing owner from the Safe.
  • useSwapOwner: Swaps an owner in the Safe.

3. useSignerClientMutation (internal hook)

An internal hook for sending custom mutations via the SafeClient. This is used by the newly added useUpdateThreshold and useUpdateOwners hooks to facilitate the necessary mutations.

Demo

The new hooks are used on the demo app in this PR.

The useSendTransaction hook now handles both TransactionBase and SafeTransaction objects. It maps the transactions array and converts any SafeTransaction objects to the required format before sending them to the signerClient.
It defines whether the connected signer is an owner of the configured Safe
It wraps the individual hooks:
- `useAddOwner`
- `useRemoveOwner`
- `useSwapOwner`
Refactor the usePendingTransactions hook to use the usePublicClientQuery hook instead of the usePublicClient hook.
@coveralls
Copy link

coveralls commented Sep 27, 2024

Coverage Status

coverage: 95.658% (-0.07%) from 95.724%
when pulling 2d931f4 on feat/update-safe-config-hooks
into 6f620f2 on main.

tmjssz added 3 commits October 7, 2024 14:58
The config param can only be defined in combination with the safeTxHash param.
@tmjssz tmjssz force-pushed the feat/update-safe-config-hooks branch from e83b6f7 to 2d931f4 Compare October 9, 2024 12:27
@tmjssz tmjssz linked an issue Oct 9, 2024 that may be closed by this pull request
@tmjssz tmjssz merged commit 6e40ebc into main Oct 9, 2024
2 checks passed
@tmjssz tmjssz deleted the feat/update-safe-config-hooks branch October 9, 2024 12:34
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.

[React Hooks] Update Safe configuration
3 participants