Skip to content

Commit

Permalink
fix: export types and rename useSafe return type (#17)
Browse files Browse the repository at this point in the history
* chore: Add hook types to exports

Adding paramter and return types of hooks to exports.

* Extends exports by SafeProvider and SafeContext types

* fix: Rename useSafe hook's return type to `UseSafeReturnType`
  • Loading branch information
tmjssz authored Oct 16, 2024
1 parent 028d40f commit f034861
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useSafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { MissingSafeProviderError } from '@/errors/MissingSafeProviderError.js'
import { SafeContext } from '@/SafeContext.js'

export type UseReturnType = UseConnectSignerReturnType & {
export type UseSafeReturnType = UseConnectSignerReturnType & {
isInitialized: boolean
getBalance: typeof useBalance
getChain: typeof useChain
Expand All @@ -28,7 +28,7 @@ export type UseReturnType = UseConnectSignerReturnType & {
* Top-level hook to get Safe-related information.
* @returns Object wrapping the Safe hooks.
*/
export function useSafe(): UseReturnType {
export function useSafe(): UseSafeReturnType {
const { isInitialized, config } = useContext(SafeContext)

if (!config) {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useSendTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useWaitForTransaction } from '@/hooks/useWaitForTransaction.js'
import { MutationKey, QueryKey } from '@/constants.js'
import { invalidateQueries } from '@/queryClient.js'

type SendTransactionVariables = { transactions: (TransactionBase | SafeTransaction)[] }
export type SendTransactionVariables = { transactions: (TransactionBase | SafeTransaction)[] }

export type UseSendTransactionParams = ConfigParam<SafeConfigWithSigner>
export type UseSendTransactionReturnType = Omit<
Expand Down
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export {
useConfirmTransaction,
useSafe,
useSendTransaction,
useUpdateOwners,
useUpdateThreshold
} from '@/hooks/index.js'
export * from '@/hooks/useSafe.js'
export * from '@/hooks/useConfirmTransaction.js'
export * from '@/hooks/useSendTransaction.js'
export * from '@/hooks/useUpdateOwners/index.js'
export * from '@/hooks/useUpdateThreshold.js'

export * from '@/types/index.js'
export { SafeProvider } from './SafeProvider.js'
export { SafeContext } from './SafeContext.js'

export * from './SafeProvider.js'
export { SafeContext, SafeContextType } from './SafeContext.js'
export { createConfig } from './createConfig.js'

0 comments on commit f034861

Please sign in to comment.