Skip to content

Commit

Permalink
fix: fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
just-toby committed Aug 3, 2023
1 parent 335446c commit fc2789a
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 1,296 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ name: CI
on: [push]
jobs:
build:
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
name: Build, lint, and test on Node 16.x and ubuntu-latest

runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['12.x', '14.x', '16.x']
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use Node ${{ matrix.node }}
- name: Use Node 16.x
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
node-version: 16.x

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ jobs:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v2
- name: Use Node 16
uses: actions/setup-node@v2
with:
node-version: 16.x
- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.x
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
"@types/lodash": "^4.14.179",
"@uniswap/token-lists": "^1.0.0-beta.33",
"dts-cli": "^1.4.0",
"eslint-plugin-prettier": "^5.0.0",
"husky": "^7.0.4",
"size-limit": "^7.0.8",
"ts-jest": "^29.1.1",
"tslib": "^2.3.1",
"typescript": "^4.5.5"
"typescript": "^4.5.5",
"yarn-deduplicate": "^6.0.2"
},
"engines": {
"node": ">=12"
"node": ">=16"
},
"files": [
"dist",
Expand Down Expand Up @@ -44,7 +47,8 @@
"prepare": "dts build",
"size": "size-limit",
"start": "dts watch",
"test": "dts test"
"test": "dts test",
"deduplicate": "yarn-deduplicate --strategy=highest"
},
"size-limit": [
{
Expand All @@ -59,13 +63,13 @@
"typings": "dist/index.d.ts",
"version": "2.1.0",
"dependencies": {
"@arbitrum/sdk": "^1.1.4",
"@uniswap/sdk-core": "^3.0.1",
"@arbitrum/sdk": "^3.1.6",
"@uniswap/sdk-core": "^4.0.6",
"axios": "^0.26.0",
"dotenv": "^16.0.1",
"ethers": "^5.6.5",
"lodash": "^4.17.21",
"prettier": "^2.7.1",
"prettier": "^3.0.1",
"web3": "^1.7.3"
}
}
12 changes: 10 additions & 2 deletions src/arbitrum/instantiate_bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { providers } from 'ethers'

const networkID = 42161

const l2Rpc = (chainId: number) => {
if (chainId === 42161) return 'https://arb1.arbitrum.io/rpc'
else if (chainId === 421611) return 'https://rinkeby.arbitrum.io/rpc'
else if (chainId === 42170) return 'https://nova.arbitrum.io/rpc'
else if (chainId === 421613) return 'https://goerli-rollup.arbitrum.io/rpc'
throw new Error('No L2 RPC detected')
}

// ref: https://github.com/OffchainLabs/arb-token-lists/blob/master/src/lib/instantiate_bridge.ts
export const getNetworkConfig = async () => {
const { getL1Network, getL2Network, MultiCaller } = await import(
Expand All @@ -11,8 +19,8 @@ export const getNetworkConfig = async () => {
const l2Network = await getL2Network(networkID)
const l1Network = await getL1Network(l2Network.partnerChainID)

const arbProvider = new providers.JsonRpcProvider(l2Network.rpcURL)
const ethProvider = new providers.JsonRpcProvider(l1Network.rpcURL)
const arbProvider = new providers.JsonRpcProvider(l2Rpc(l2Network.chainID))
const ethProvider = new providers.JsonRpcProvider(process.env.MAINNET_RPC)

const l1MultiCaller = await MultiCaller.fromProvider(ethProvider)
const l2MultiCaller = await MultiCaller.fromProvider(arbProvider)
Expand Down
2 changes: 1 addition & 1 deletion src/providers/BaseGoerliMappingProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class BaseGoerliMappingProvider implements MappingProvider {

let allTokens = await getTokenList(baseGoerliTokenListURL)

let opTokenId_baseGoerliAddressMap = {}
let opTokenId_baseGoerliAddressMap: Record<string, string> = {}
allTokens.tokens.forEach((token) => {
if (token.chainId === ChainId.BASE_GOERLI) {
if (typeof token.extensions?.opTokenId === 'string') {
Expand Down
12 changes: 9 additions & 3 deletions src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function buildList(
} = {}
const l2MappingExtension = {
extensions: {
bridgeInfo: {},
bridgeInfo: {} as any,
},
}
// build out the extensions.bridgeInfo data containing mappings for each L2 chain
Expand Down Expand Up @@ -197,8 +197,14 @@ async function getChildTokenDetails(
childTokenAddress: string | undefined
decimals?: number | undefined
}> {
const existingMapping: undefined | string =
l1Token?.extensions?.bridgeInfo?.[chainId]?.tokenAddress
const bridgeInfo = l1Token?.extensions?.bridgeInfo
let existingMapping: undefined | string
if (bridgeInfo && typeof bridgeInfo === 'object') {
const bridgeInfoForChain = bridgeInfo[chainId]
if (bridgeInfoForChain && typeof bridgeInfoForChain === 'object') {
existingMapping = bridgeInfoForChain.tokenAddress as string
}
}
// use the externally fetched mappings if manual entry doesn't exist for the token/chain mapping
// and the given chain is supported for fetching mappings
if (
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"suppressImplicitAnyIndexErrors": true
"noEmit": true,
"allowImportingTsExtensions": true
}
}
}
Loading

0 comments on commit fc2789a

Please sign in to comment.