Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Use canonical addresses for fetching safes
Alexis Sellier committed 4 years ago
commit 66c920d578e6cb41d7fe2e737ec4cd0966f10d5d
parent 52385e03b2c0f35749d33a889f8d81b478f3fa9f
1 file changed +4 -2
modified src/utils.ts
@@ -177,7 +177,8 @@ export async function resolveLabel(label: string, config: Config): Promise<strin
export async function isSafe(address: string, config: Config): Promise<boolean> {
  if (! config.safe.api) return false;

-
  const response = await fetch(`${config.safe.api}/safes/${address}`, { method: 'HEAD' });
+
  const addr = ethers.utils.getAddress(address);
+
  const response = await fetch(`${config.safe.api}/safes/${addr}`, { method: 'HEAD' });

  return response.ok;
}
@@ -186,7 +187,8 @@ export async function isSafe(address: string, config: Config): Promise<boolean>
export async function getSafe(address: string, config: Config): Promise<Safe | null> {
  if (! config.safe.api) return null;

-
  const response = await fetch(`${config.safe.api}/safes/${address}`, {
+
  const addr = ethers.utils.getAddress(address);
+
  const response = await fetch(`${config.safe.api}/safes/${addr}`, {
    method: 'GET',
    headers: {
      'Accept': 'application/json',