From 63a6af2c7f85c35ea0eab517a3aa6b1f0575a992 Mon Sep 17 00:00:00 2001 From: Nicolas Mahe Date: Wed, 19 Mar 2025 17:20:40 +0700 Subject: [PATCH 1/3] Add Alchemy info to BSC chains --- environment.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/environment.ts b/environment.ts index 6f86d457..628497f9 100644 --- a/environment.ts +++ b/environment.ts @@ -241,8 +241,26 @@ const getEnvironment = async (): Promise => { CHAINS: [ ethereumMainnet, ethereumSepolia, - bscTestnet, - bsc, + { + ...bsc, + rpcUrls: { + ...bsc.rpcUrls, + alchemy: { + http: ['https://bnb-mainnet.g.alchemy.com/v2'], + webSocket: ['wss://bnb-mainnet.g.alchemy.com/v2'], + }, + }, + }, + { + ...bscTestnet, + rpcUrls: { + ...bscTestnet.rpcUrls, + alchemy: { + http: ['https://bnb-testnet.g.alchemy.com/v2'], + webSocket: ['wss://bnb-testnet.g.alchemy.com/v2'], + }, + }, + }, polygon, { id: 80_002, From 0a2321215befb98b57e3c6f2bb982a0afcb0006a Mon Sep 17 00:00:00 2001 From: Nicolas Mahe Date: Wed, 19 Mar 2025 17:42:29 +0700 Subject: [PATCH 2/3] Use Alchemy in email connector --- connectors.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/connectors.ts b/connectors.ts index dca6593c..94f6f2af 100644 --- a/connectors.ts +++ b/connectors.ts @@ -61,7 +61,11 @@ function connectors(environment: Environment): ClientWithChain { walletConnectWallet({ chains, projectId }), braveWallet({ chains, shimDisconnect }), environment.MAGIC_API_KEY - ? emailConnector({ chains, apiKey: environment.MAGIC_API_KEY }) + ? emailConnector({ + chains, + apiKey: environment.MAGIC_API_KEY, + alchemyApiKey: environment.ALCHEMY_API_KEY, + }) : undefined, ].filter(Boolean), }, @@ -95,10 +99,16 @@ function connectors(environment: Environment): ClientWithChain { function emailConnector({ chains, apiKey, + alchemyApiKey, }: { chains: Chain[] apiKey: string + alchemyApiKey: string | undefined }): Wallet { + if (!alchemyApiKey) + throw new Error( + 'env NEXT_PUBLIC_ALCHEMY_API_KEY is required for email connector', + ) return { id: 'magic', name: 'Magic', @@ -112,8 +122,8 @@ function emailConnector({ networks: chains.map((chain) => ({ chainId: chain.id, rpcUrl: - chain.id === 1 // the default provider for Ethereum Mainnet (cloudflare) is not working with Magic - ? 'https://rpc.ankr.com/eth' + chain.id === 1 // the default provider for Ethereum Mainnet is not working with Magic, only Alchemy is + ? 'https://eth-mainnet.g.alchemy.com/v2/' + alchemyApiKey : chain.rpcUrls.default.http[0]!, })), }, From 0a70e3bad585aa0d9cd7b175bb115d9b4528bb1d Mon Sep 17 00:00:00 2001 From: Nicolas Mahe Date: Thu, 20 Mar 2025 11:22:45 +0700 Subject: [PATCH 3/3] update CI and add build job --- .github/workflows/ci.yml | 49 ++++++++++++---------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56a84418..20f5384c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,41 +4,20 @@ jobs: lint: runs-on: ubuntu-latest steps: - - name: Checkout repo - uses: actions/checkout@v2 - - - name: Install Node - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - - name: Node version - run: node -v - - - name: Npm version - run: npm -v - - - name: Set version in env - run: | - echo "node-version=$(node -v)" >> $GITHUB_ENV - echo "npm-version=$(npm -v)" >> $GITHUB_ENV - - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules + - run: npm ci + - run: npm run lint + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - path: '**/node_modules' - key: ${{ runner.os }}-${{ env.cache-name }}-node${{ env.node-version }}-npm${{ env.npm-version }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-${{ env.cache-name }}-node${{ env.node-version }}-npm${{ env.npm-version }}- - - - name: Install dependencies - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npm install - - - name: Lint - run: npm run lint + node-version: 20 + cache: 'npm' + - run: npm ci + - run: npm run build