Skip to content

Commit

Permalink
fix: conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Feb 20, 2024
2 parents f5e3a80 + 7d88536 commit ebd54e1
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 22 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"useGitignore": true,
"language": "en",
"words": [
"solmate",
"binkey",
"binsec",
"chainlist",
"cirip",
"dataurl",
"devpool",
Expand All @@ -25,6 +25,7 @@
"Rpcs",
"scalarmult",
"servedir",
"solmate",
"sonarjs",
"typebox",
"TYPEHASH",
Expand Down
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/esbuild-build.ts
static/scripts/rewards/constants.ts
static/scripts/rewards/render-transaction/render-transaction.ts
**/lib/**
19 changes: 4 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Build & Deploy

on:
push:
pull_request:
workflow_dispatch:

jobs:
Expand All @@ -12,6 +13,8 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: "recursive" # Ensures submodules are checked out

- name: Set up Node.js
uses: actions/setup-node@v4
Expand All @@ -24,31 +27,17 @@ jobs:
yarn build
echo -n $(echo "${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" | cut -c1-7) > static/commit.txt
- name: Check Cloudflare API Token
id: check_token
run: |
if [[ -z "${{ secrets.CLOUDFLARE_API_TOKEN }}" ]]; then
echo "Cloudflare API token is not set. Skipping deployment."
echo "skip=true" >> $GITHUB_ENV
else
echo "skip=false" >> $GITHUB_ENV
fi
shell: bash

- name: Deploy to Cloudflare
if: env.skip != 'true'
uses: ubiquity/cloudflare-deploy-action@main
with:
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cloudflare_api_token: JWo5dPsoyohH5PRu89-RktjCvRN0-ODC6CC9ZBqF # Specifically scoped for public contributors to automatically deploy to our team Cloudflare account
repository: ${{ github.repository }}
production_branch: ${{ github.event.repository.default_branch }}
output_directory: "static"
current_branch: ${{ github.ref_name }}
pull_request_number: ${{ github.event.pull_request.number }}
commit_sha: ${{ github.sha }}
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
app_id: ${{ secrets.APP_ID }}
app_installation_id: ${{ secrets.APP_INSTALLATION_ID }}
# Add any environment variables you need to pass along here
# SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
# SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
path = lib/ubiquibot
url = https://github.com/ubiquity/ubiquibot
shallow = true
[submodule "lib/chainlist"]
path = lib/chainlist
url = https://github.com/DefiLlama/chainlist.git
13 changes: 13 additions & 0 deletions build/esbuild-build.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import extraRpcs from "../lib/chainlist/constants/extraRpcs";
import esbuild from "esbuild";
const typescriptEntries = [
"static/scripts/rewards/index.ts",
Expand All @@ -8,6 +9,15 @@ const typescriptEntries = [
const cssEntries = ["static/styles/rewards/rewards.css", "static/styles/audit-report/audit.css", "static/styles/onboarding/onboarding.css"];
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.

Object.keys(extraRpcs).forEach((networkId) => {
const officialUrls = extraRpcs[networkId].rpcs.filter((rpc) => typeof rpc === "string");
const extraUrls: string[] = extraRpcs[networkId].rpcs.filter((rpc) => rpc.url !== undefined).map((rpc) => rpc.url);
allNetworkUrls[networkId] = [...officialUrls, ...extraUrls];
});

export const esBuildContext: esbuild.BuildOptions = {
sourcemap: true,
entryPoints: entries,
Expand All @@ -22,6 +32,9 @@ export const esBuildContext: esbuild.BuildOptions = {
".svg": "dataurl",
},
outdir: "static/out",
define: {
extraRpcs: JSON.stringify(allNetworkUrls),
},
};

esbuild
Expand Down
2 changes: 1 addition & 1 deletion lib/ubiquibot
Submodule ubiquibot updated 214 files
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"format:lint": "eslint --fix .",
"format:prettier": "prettier --write .",
"format:cspell": "cspell **/*",
"prepare": "husky install"
"prepare": "husky install",
"postinstall": "git submodule update --init --recursive"
},
"keywords": [
"typescript",
Expand Down
13 changes: 10 additions & 3 deletions static/scripts/rewards/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
// type RPC = { url: string; tracking?: string; trackingDetails?: string };
// type Network = { name?: string; rpcs: RPC[]; websiteDead?: boolean; rpcWorking?: boolean };
// type Networks = { [key: string]: Network };

declare const extraRpcs: Record<string, string[]>; // @DEV: passed in at build time check build/esbuild-build.ts

export enum NetworkIds {
Mainnet = 1,
Goerli = 5,
Gnosis = 100,
}
console.trace({ extraRpcs });

export enum Tokens {
DAI = "0x6b175474e89094c44da98b954eedeac495271d0f",
Expand Down Expand Up @@ -36,9 +43,9 @@ export const networkExplorers: Record<number, string> = {
};

export const networkRpcs: Record<number, string[]> = {
[NetworkIds.Mainnet]: ["https://rpc-pay.ubq.fi/v1/mainnet"],
[NetworkIds.Goerli]: ["https://rpc-pay.ubq.fi/v1/goerli"],
[NetworkIds.Gnosis]: ["https://rpc.gnosischain.com"],
[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] || [])],
};

export const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { renderNftSymbol } from "./render-token-symbol";
import { setClaimMessage } from "./set-claim-message";
import { claimTxT } from "./tx-type";
import { removeAllEventListeners } from "./utils";
import { handleNetwork } from "../web3/wallet";

let optimalRPC: JsonRpcProvider;

Expand All @@ -34,7 +35,7 @@ export async function init() {
app.claimTxs = claimTxs;
optimalRPC = await getOptimalProvider(app.currentTx?.networkId ?? app.claimTxs[0].networkId);

// handleNetwork(app.currentTx?.networkId ?? app.claimTxs[0].networkId).catch(console.error);
handleNetwork(app.currentTx?.networkId ?? app.claimTxs[0].networkId).catch(console.error);
} catch (error) {
console.error(error);
setClaimMessage({ type: "Error", message: `Invalid claim data passed in URL` });
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"include": ["src", "lib/chainlist/constants/extraRpcs.js", "static", "build", "scripts/typescript", "globals.d.ts"],
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
Expand Down

0 comments on commit ebd54e1

Please sign in to comment.