From ff3ff3e9971901e91aaf6041c915b45ebd5e249c Mon Sep 17 00:00:00 2001 From: Reinis Martinsons Date: Tue, 20 Feb 2024 20:47:48 +0000 Subject: [PATCH] fix: custom safe url for core Signed-off-by: Reinis Martinsons --- src/plugins/oSnap/constants.ts | 18 ++++++++++++++++-- src/plugins/oSnap/utils/getters.ts | 3 ++- src/plugins/safeSnap/constants.ts | 6 ++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/plugins/oSnap/constants.ts b/src/plugins/oSnap/constants.ts index 6dfd37c8a..99991cafa 100644 --- a/src/plugins/oSnap/constants.ts +++ b/src/plugins/oSnap/constants.ts @@ -1105,7 +1105,8 @@ export const EXPLORER_API_URLS = { '246': 'https://explorer.energyweb.org/api', '137': 'https://api.polygonscan.com/api', '56': 'https://api.bscscan.com/api', - '42161': 'https://api.arbiscan.io/api' + '42161': 'https://api.arbiscan.io/api', + // '1116': Add 'https://openapi.coredao.org/api' if API key requirement is removed } as const; export const GNOSIS_SAFE_TRANSACTION_API_URLS = { @@ -1116,7 +1117,20 @@ export const GNOSIS_SAFE_TRANSACTION_API_URLS = { '246': 'https://safe-transaction-ewc.safe.global/api', '137': 'https://safe-transaction-polygon.safe.global/api', '56': 'https://safe-transaction-bsc.safe.global/api', - '42161': 'https://safe-transaction-arbitrum.safe.global/api' + '42161': 'https://safe-transaction-arbitrum.safe.global/api', + // '1116': Add when public tx service is available for Core +} as const; + +export const SAFE_APP_URLS = { + '1': 'https://app.safe.global/apps/open', + '5': 'https://app.safe.global/apps/open', + '100': 'https://app.safe.global/apps/open', + '73799': 'https://app.safe.global/apps/open', + '246': 'https://app.safe.global/apps/open', + '137': 'https://app.safe.global/apps/open', + '56': 'https://app.safe.global/apps/open', + '42161': 'https://app.safe.global/apps/open', + '1116': 'https://safe.coredao.org/apps/open' } as const; // ABIs diff --git a/src/plugins/oSnap/utils/getters.ts b/src/plugins/oSnap/utils/getters.ts index b03912c3b..dc4f31db2 100644 --- a/src/plugins/oSnap/utils/getters.ts +++ b/src/plugins/oSnap/utils/getters.ts @@ -14,6 +14,7 @@ import { GNOSIS_SAFE_TRANSACTION_API_URLS, OPTIMISTIC_GOVERNOR_ABI, OPTIMISTIC_ORACLE_V3_ABI, + SAFE_APP_URLS, contractData, safePrefixes, solidityZeroHexString @@ -247,9 +248,9 @@ export function makeConfigureOsnapUrl(params: { network, spaceName, spaceUrl, - baseUrl = 'https://app.safe.global/apps/open', appUrl = 'https://osnap.uma.xyz/' } = params; + const baseUrl = params.baseUrl ?? SAFE_APP_URLS[network] ?? 'https://app.safe.global/apps/open'; const safeAddressPrefix = getSafeNetworkPrefix(network); const appUrlSearchParams = new URLSearchParams(); appUrlSearchParams.set('spaceName', spaceName); diff --git a/src/plugins/safeSnap/constants.ts b/src/plugins/safeSnap/constants.ts index a19b226e1..0f995e8e1 100644 --- a/src/plugins/safeSnap/constants.ts +++ b/src/plugins/safeSnap/constants.ts @@ -30,7 +30,8 @@ export const EXPLORER_API_URLS = { '246': 'https://explorer.energyweb.org/api', '137': 'https://api.polygonscan.com/api', '56': 'https://api.bscscan.com/api', - '42161': 'https://api.arbiscan.io/api' + '42161': 'https://api.arbiscan.io/api', + // '1116': Add 'https://openapi.coredao.org/api' if API key requirement is removed }; export const GNOSIS_SAFE_TRANSACTION_API_URLS = { @@ -41,7 +42,8 @@ export const GNOSIS_SAFE_TRANSACTION_API_URLS = { '246': 'https://safe-transaction-ewc.safe.global/api', '137': 'https://safe-transaction-polygon.safe.global/api', '56': 'https://safe-transaction-bsc.safe.global/api', - '42161': 'https://safe-transaction-arbitrum.safe.global/api' + '42161': 'https://safe-transaction-arbitrum.safe.global/api', + // '1116': // Add when public tx service is available for Core }; // ABIs