remove
Contains the removeOwner
and removeOwnerAsync
functions, which execute a Safe transaction to remove an owner of the Safe connected to the SafeProvider
or send it to the Safe Transaction Service if it isn't executable.
Usage
- If the
threshold
of the connected Safe is greater than1
, it creates the Safe transaction and submits it to the Safe Transaction Service to collect the signatures from the Safe owners. - If the
threshold
of the connected Safe is1
, it executes the Safe transaction.
The connected Safe must be already deployed.
_26import { useUpdateOwners, RemoveOwnerVariables } from '@safe-global/safe-react-hooks'_26_26function RemoveOwner() {_26 const { remove } = useUpdateOwners()_26 const {_26 removeOwner,_26 data,_26 // ..._26 } = remove_26_26 const removeOwnerParams: RemoveOwnerVariables = {_26 ownerAddress: '0x...',_26 threshold: 1 // Optional_26 }_26_26 return (_26 <>_26 <button onClick={() => removeOwner(removeOwnerParams)}>_26 Remove Owner_26 </button>_26 {data && JSON.stringify(data)}_26 </>_26 )_26}_26_26export default RemoveOwner
Structure
UseRemoveOwnerReturnType
_10import { UseRemoveOwnerReturnType } from '@safe-global/safe-react-hooks'
TanStack Query mutation documentation (opens in a new tab).
removeOwner
- Type:
UseMutateFunction<SafeClientResult, Error, RemoveOwnerVariables, unknown>
Function to remove an owner of the connected Safe.
Parameters
RemoveOwnerVariables
_10import { RemoveOwnerVariables } from '@safe-global/safe-react-hooks'
Variables to update the threshold.
Returns
SafeClientResult
(opens in a new tab)
The result of the transaction in the data
property.
removeOwnerAsync
- Type:
UseMutateAsyncFunction<SafeClientResult, Error, RemoveOwnerVariables, unknown>
Asynchronous function to remove an owner of the connected Safe.
Parameters
RemoveOwnerVariables
_10import { RemoveOwnerVariables } from '@safe-global/safe-react-hooks'
Variables to update the threshold.
Returns
SafeClientResult
(opens in a new tab)
The result of the transaction in the data
property.
data
- Type:
SafeClientResult
(opens in a new tab) - Default:
undefined
The last successfully resolved data for the mutation.
error
- Type:
null | TError
- Default:
null
The error object for the mutation, if an error was encountered.
failureCount
- Type:
number
The failure count for the mutation.
Incremented every time the mutation fails.
Reset to 0
when the mutation succeeds.
failureReason
- Type:
null | TError
The failure reason for the mutation retry.
Reset to null
when the mutation succeeds.
isError
/ isIdle
/ isPending
/ isSuccess
- Type:
boolean
The boolean variables derived from status
.
isPaused
- Type:
boolean
Will be true
if the mutation has been paused
.
See Network Mode (opens in a new tab) for more information.
reset
- Type:
() => void
A function to clean the mutation internal state (for example, it resets the mutation to its initial state).
status
- Type:
'idle' | 'pending' | 'error' | 'success'
'idle'
initial status prior to the mutation function executing.
'pending'
if the mutation is currently executing.
'error'
if the last mutation attempt resulted in an error.
'success'
if the last mutation attempt was successful.
submittedAt
- Type:
number
- Default:
0
The timestamp for when the mutation was submitted.
variables
- Type:
RemoveOwnerVariables
- Default:
undefined
The variables
object passed to the mutation function.