Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sub 1s loading UI #169

Merged
merged 27 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
35d0b99
feat: call db to retrieve permits instead of parsing github
gentlementlegen Feb 17, 2024
7528f3e
chore: issue number now uses the value from git get request
gentlementlegen Feb 17, 2024
2b21d66
Merge branch 'development' into permit-urls-from-db
Feb 17, 2024
655ead5
chore: fixed merged characters
gentlementlegen Feb 17, 2024
72b23f2
Merge remote-tracking branch 'origin/development' into permit-urls-fr…
gentlementlegen Feb 19, 2024
3b7c3d2
Merge remote-tracking branch 'pay.ubiquity/development' into permit-u…
gentlementlegen Feb 19, 2024
2f11234
chore: merged development branch
gentlementlegen Feb 19, 2024
0878552
chore: added Action secrets to the build.yml
gentlementlegen Feb 19, 2024
f5e3a80
feat: sub 1s load time
Keyrxng Feb 20, 2024
ebd54e1
fix: conflicts
Keyrxng Feb 20, 2024
7fab1b4
chore: fetch inside try
Keyrxng Feb 20, 2024
f1ca988
feat: sub 1s load time
Keyrxng Feb 20, 2024
97fb13c
chore: fetch inside try
Keyrxng Feb 20, 2024
2adf64b
fix: revert and pull from head
Keyrxng Feb 20, 2024
a1c6e4b
chore: renamed supabase key to SUPABASE_PUBLIC_ANON_KEY
gentlementlegen Feb 21, 2024
0ba50af
chore: renamed supabase key to SUPABASE_ANON_KEY
gentlementlegen Feb 21, 2024
5a504fd
chore: allow personal repo to be searched
gentlementlegen Feb 21, 2024
ba87b12
chore: renamed supabase env variables
gentlementlegen Feb 21, 2024
53ab0ec
Merge pull request #164 from FernandVEYRIER/permit-urls-from-db
0x4007 Feb 21, 2024
b592128
Merge branch 'fix/perf' into development
0x4007 Feb 21, 2024
c0249df
Merge branch 'ubiquity:development' into speed-improvements
Keyrxng Feb 21, 2024
517dd48
fix: use allnetworkurls
Keyrxng Feb 21, 2024
1fe025d
fix: rpc blacklist
Keyrxng Feb 23, 2024
fd9a8e5
fix: continuous deploys
0x4007 Feb 25, 2024
24284bd
Merge pull request #176 from pavlovcik/fix/cd
0x4007 Feb 25, 2024
6f3bfdf
Merge branch 'ubiquity:development' into speed-improvements
Keyrxng Feb 26, 2024
16a534e
fix: no network resolved
Keyrxng Feb 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/esbuild-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export const entries = [...typescriptEntries, ...cssEntries];
const allNetworkUrls: Record<string, string[]> = {};
// this flattens all the rpcs into a single object, with key names that match the networkIds. The arrays are just of URLs per network ID.

const blacklist = ["https://xdai-archive.blockscout.com"];
const blacklist = ["https://xdai-archive.blockscout.com", "https://gnosis.api.onfinality.io/public"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blacklist idea doesn't seem like a robust approach. We can merge it in but it should be handled dynamically. I think I implemented this in an unstable manner on my branch, I vaguely recall.

Copy link
Contributor Author

@Keyrxng Keyrxng Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the issue is that the claim button flickers on a failure then finding out why exactly that's happening because of a failed background call would probs be the best way to handle it I guess, otherwise just try{}catch() and don't log the error? seems hacky we could care less if one or two calls have failed

Copy link
Member

@0x4007 0x4007 Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because the CSS/style logic is implemented poorly. I tore it apart in my refactor but didn't get to put it all together in a totally stable way (mostly the other RPC related functions- I believe the styling code was significantly simplified and stable if I recall correctly).

Unfortunately I'm running very low on code time because I'll need to focus on fundraising starting next week. So I'm just going to be focusing on top priority stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Luckily for me I've got nothing but code time, regretfully it does eventually require that you have review time lmao but I'll keep on pushing forward with things as best I can in the meantime, cheers for the heads up


Object.keys(extraRpcs).forEach((networkId) => {
const officialUrls = extraRpcs[networkId].rpcs.filter((rpc) => {
if (typeof rpc === "string") {
if (blacklist.includes(rpc)) {
return "";
return null;
} else {
return rpc;
}
Expand Down
12 changes: 2 additions & 10 deletions scripts/typescript/generate-permit2-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ dotenv.config();

const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3"; // same on all chains

generate().catch((error) => {
generateERC20Permit().catch((error) => {
console.error(error);
verifyEnvironmentVariables();
process.exitCode = 1;
});

async function generate(multi = false) {
export async function generateERC20Permit(multi = false) {
const provider = new ethers.providers.JsonRpcProvider(process.env.RPC_PROVIDER_URL);
const myWallet = new ethers.Wallet(process.env.UBIQUIBOT_PRIVATE_KEY || "", provider);

Expand Down Expand Up @@ -70,11 +70,3 @@ async function generate(multi = false) {
console.log();
}
}

export async function generateMultiERC20Permits() {
for (let i = 0; i < 5; i++) {
const url = await generate(true);
log.ok("Testing URL:");
console.log(url);
}
}
16 changes: 16 additions & 0 deletions scripts/typescript/multi-permits.t.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { generateERC20Permit } from "./generate-permit2-url";
import { log, verifyEnvironmentVariables } from "./utils";

export async function generateMultiERC20Permits() {
for (let i = 0; i < 5; i++) {
const url = await generateERC20Permit();
log.ok("Testing URL:");
console.log(url);
}
}

generateMultiERC20Permits().catch((error) => {
console.error(error);
verifyEnvironmentVariables();
process.exitCode = 1;
});
5 changes: 5 additions & 0 deletions static/scripts/rewards/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum NetworkIds {
Mainnet = 1,
Goerli = 5,
Gnosis = 100,
Anvil = 31337,
}

export enum Tokens {
Expand All @@ -19,12 +20,14 @@ export const networkNames = {
[NetworkIds.Mainnet]: "Ethereum Mainnet",
[NetworkIds.Goerli]: "Goerli Testnet",
[NetworkIds.Gnosis]: "Gnosis Chain",
[NetworkIds.Anvil]: "http://127.0.0.1:8545",
};

export const networkCurrencies: Record<number, object> = {
[NetworkIds.Mainnet]: { symbol: "ETH", decimals: 18 },
[NetworkIds.Goerli]: { symbol: "GoerliETH", decimals: 18 },
[NetworkIds.Gnosis]: { symbol: "XDAI", decimals: 18 },
[NetworkIds.Anvil]: { symbol: "XDAI", decimals: 18 },
};

export function getNetworkName(networkId?: number) {
Expand All @@ -39,12 +42,14 @@ export const networkExplorers: Record<number, string> = {
[NetworkIds.Mainnet]: "https://etherscan.io",
[NetworkIds.Goerli]: "https://goerli.etherscan.io",
[NetworkIds.Gnosis]: "https://gnosisscan.io",
[NetworkIds.Anvil]: "https://gnosisscan.io",
};

export const networkRpcs: Record<number, string[]> = {
[NetworkIds.Mainnet]: ["https://rpc-pay.ubq.fi/v1/mainnet", ...(extraRpcs[NetworkIds.Mainnet] || [])],
[NetworkIds.Goerli]: ["https://rpc-pay.ubq.fi/v1/goerli", ...(extraRpcs[NetworkIds.Goerli] || [])],
[NetworkIds.Gnosis]: [...(extraRpcs[NetworkIds.Gnosis] || [])],
[NetworkIds.Anvil]: ["http://127.0.0.1:8545", ""],
};

export const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
Expand Down
7 changes: 7 additions & 0 deletions static/scripts/rewards/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export async function getErc20Contract(contractAddress: string, provider: JsonRp
}

export async function getOptimalProvider(networkId: number) {
if (networkId === 31337)
return new ethers.providers.JsonRpcProvider("http://127.0.0.1:8545", {
name: "http://127.0.0.1:8545",
chainId: 31337,
ensAddress: "",
});

const promises = networkRpcs[networkId].map(async (baseURL: string) => {
try {
const startTime = performance.now();
Expand Down