@safe-global/safe-react-hooks
Version:
A collection of React Hooks that facilitates the interaction of React apps with Safe Smart Accounts
19 lines • 822 B
JavaScript
import { useSignerClient } from '../hooks/useSignerClient.js';
import { useAsyncMemo } from '../hooks/helpers/useAsyncMemo.js';
/**
* Hook to get the configured signer's address.
* @param params Parameters to customize the hook behavior.
* @param params.config SafeConfig to use instead of the one provided by `SafeProvider`.
* @returns Signer address or `undefined` if not available.
*/
export function useSignerAddress(params = {}) {
const signerClient = useSignerClient({ config: params.config });
const signerAddress = useAsyncMemo(async () => signerClient
? signerClient.protocolKit
.getSafeProvider()
.getSignerAddress()
.then((address) => address)
: undefined, [signerClient]);
return signerAddress;
}
//# sourceMappingURL=useSignerAddress.js.map