Skip to content

Commit

Permalink
remove eth wallet, fix typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Oct 31, 2024
1 parent 5058158 commit 8c35ed4
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 173 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run prettier
run: pnpm run fmt
run: pnpm run format
# We run prettier and commit the changes if formatting fixed
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
Expand Down
107 changes: 0 additions & 107 deletions apps/main/src/wallets/ethereum-wallet.ts

This file was deleted.

7 changes: 0 additions & 7 deletions apps/main/src/wallets/near-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import { JsonRpcProvider } from "@near-js/providers";
import { getTransactionLastResult } from "@near-js/utils";

// wallet selector
import { transformedWeb3Modal, wagmiConfig } from "@/wallets/ethereum-wallet";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";
import {
Action,
NetworkId,
setupWalletSelector
} from "@near-wallet-selector/core";
import { setupEthereumWallets } from "@near-wallet-selector/ethereum-wallets";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
Expand Down Expand Up @@ -99,11 +97,6 @@ export class Wallet {
setupOKXWallet(),
// @ts-expect-error - "property does not exist", ya whatever
setupMeteorWallet(),
// This configuration comes from wallets/evm
setupEthereumWallets({
wagmiConfig: wagmiConfig,
web3Modal: transformedWeb3Modal
}),
// @ts-expect-error - "property does not exist", ya whatever
setupLedger(),
// @ts-expect-error - "property does not exist", ya whatever
Expand Down
124 changes: 67 additions & 57 deletions apps/main/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,70 +5,80 @@ import path from "path";
import { defineConfig } from "vite";
import { nodePolyfills } from "vite-plugin-node-polyfills";

export default defineConfig({
plugins: [
TanStackRouterVite(),
react(),
nodePolyfills({ globals: { global: true } })
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src")
}
},
server: {
host: "every.near.page",
https: {
key: fs.readFileSync("./_wildcard.near.page-key.pem"),
cert: fs.readFileSync("./_wildcard.near.page.pem")
export default defineConfig(({ mode }) => {
const isDevelopment = mode === "development";

return {
plugins: [
TanStackRouterVite(),
react(),
nodePolyfills({ globals: { global: true } })
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src")
}
},
proxy: {
"/ai": "http://localhost:3005",
"/web4": {
target: "https://localhost:3000",
secure: false,
changeOrigin: true,
ws: true, // Enable WebSocket proxy
configure: (proxy, options) => {
// Add error logging
proxy.on("error", (err, req, res) => {
console.error("proxy error", err);
});
server: {
...(isDevelopment && {
// Local development server settings
host: "every.near.page",
https: {
key: fs.readFileSync("./_wildcard.near.page-key.pem"),
cert: fs.readFileSync("./_wildcard.near.page.pem")
},
proxy: {
"/web4": {
target: "https://localhost:3000",
secure: false,
changeOrigin: true,
ws: true,
configure: (proxy, options) => {
// Add error logging for /web4 proxy
proxy.on("error", (err, req, res) => {
console.error("proxy error", err);
});

proxy.on("proxyReq", (proxyReq, req, res, options) => {
// Ensure proper host header
proxyReq.setHeader("Host", "every.near.page");
proxy.on("proxyReq", (proxyReq, req, res, options) => {
// Ensure proper host header
proxyReq.setHeader("Host", "every.near.page");
console.log("Outgoing cookies:", req.headers.cookie);
});

console.log("Outgoing cookies:", req.headers.cookie);
});
proxy.on("proxyRes", (proxyRes, req, res) => {
console.log("Incoming cookies:", proxyRes.headers["set-cookie"]);

proxy.on("proxyRes", (proxyRes, req, res) => {
console.log("Incoming cookies:", proxyRes.headers["set-cookie"]);
if (proxyRes.headers["set-cookie"]) {
proxyRes.headers["set-cookie"] = proxyRes.headers[
"set-cookie"
].map((cookie) =>
cookie.replace("Secure;", "Secure; SameSite=None;")
);
}

if (proxyRes.headers["set-cookie"]) {
proxyRes.headers["set-cookie"] = proxyRes.headers[
"set-cookie"
].map((cookie) =>
cookie.replace("Secure;", "Secure; SameSite=None;")
);
proxyRes.headers["Access-Control-Allow-Origin"] = "*";
proxyRes.headers["Access-Control-Allow-Methods"] =
"GET,HEAD,PUT,PATCH,POST,DELETE";
proxyRes.headers["Access-Control-Allow-Headers"] =
"Content-Type, Authorization";
proxyRes.headers["Access-Control-Allow-Credentials"] = "true";
});
},
headers: {
Connection: "keep-alive",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
"Access-Control-Allow-Headers": "Content-Type, Authorization",
"Access-Control-Allow-Credentials": "true"
}

proxyRes.headers["Access-Control-Allow-Origin"] = "*";
proxyRes.headers["Access-Control-Allow-Methods"] =
"GET,HEAD,PUT,PATCH,POST,DELETE";
proxyRes.headers["Access-Control-Allow-Headers"] =
"Content-Type, Authorization";
proxyRes.headers["Access-Control-Allow-Credentials"] = "true";
});
},
headers: {
Connection: "keep-alive",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
"Access-Control-Allow-Headers": "Content-Type, Authorization",
"Access-Control-Allow-Credentials": "true"
}
}
}),
proxy: {
"/ai": isDevelopment
? "http://localhost:3005"
: "https://api.yourdomain.com"
}
}
}
};
});
2 changes: 1 addition & 1 deletion packages/config-typescript/vite.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"module": "ESNext",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": false,
"skipLibCheck": true,
"target": "ESNext",
"types": ["vite/client"]
}
Expand Down

0 comments on commit 8c35ed4

Please sign in to comment.