Skip to content

Commit

Permalink
Revert "Delete hand-made auth, not needed anymore"
Browse files Browse the repository at this point in the history
This reverts commit a6a8f4e.
  • Loading branch information
anxolin committed Aug 10, 2023
1 parent e162cf6 commit 0e53f04
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion actions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,25 @@ export async function getProvider(
() => undefined
);
const providerConfig: ConnectionInfo =
user && password ? { url, user, password } : { url };
user && password
? {
url,
// TODO: This is a hack to make it work for HTTP endpoints (while we don't have a HTTPS one for Gnosis Chain), however I will delete once we have it
headers: {
Authorization: getAuthHeader({ user, password }),
},
// user: await getSecret(`NODE_USER_${network}`, context),
// password: await getSecret(`NODE_PASSWORD_${network}`, context),
}
: { url };

return new ethers.providers.JsonRpcProvider(providerConfig);
}

function getAuthHeader({ user, password }: { user: string; password: string }) {
return "Basic " + Buffer.from(`${user}:${password}`).toString("base64");
}

export function apiUrl(network: string): string {
switch (network) {
case "1":
Expand Down

0 comments on commit 0e53f04

Please sign in to comment.