From 48cecb6b11ae3d561fff0b804cd5abfbac173fe4 Mon Sep 17 00:00:00 2001 From: doug <4741454+douglance@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:43:36 -0500 Subject: [PATCH] refactor: clean up scripts folder (#557) --- .github/workflows/build-test.yml | 2 +- packages/sdk/package.json | 4 +- packages/sdk/scripts/builder | 4 - packages/sdk/scripts/cancelRetryable.ts | 41 ---- packages/sdk/scripts/checkRetryableStatus.ts | 37 ---- packages/sdk/scripts/cleanCompileContracts.ts | 27 --- packages/sdk/scripts/deployStandard.ts | 189 ------------------ packages/sdk/scripts/{genAbi.js => genAbi.ts} | 26 +-- packages/sdk/scripts/getCLargs.ts | 38 ---- packages/sdk/scripts/instantiate_bridge.ts | 132 ------------ packages/sdk/scripts/lib.ts | 173 ---------------- packages/sdk/scripts/postProcessDocs.js | 90 --------- packages/sdk/scripts/redeemRetryable.ts | 58 ------ packages/sdk/scripts/scrap.ts | 22 -- packages/sdk/scripts/sendL2SignedMsg.ts | 43 ---- packages/sdk/scripts/setArbCustomGateways.ts | 33 --- packages/sdk/scripts/setStandardGateways.ts | 33 --- packages/sdk/scripts/upgrade_weth.ts | 66 ------ packages/sdk/scripts/util.ts | 6 - .../childTransactionReceipt.test.ts | 2 +- .../customFeeTokenTestHelpers.ts | 2 +- .../sdk/tests/integration/customerc20.test.ts | 2 +- packages/sdk/tests/integration/eth.test.ts | 2 +- .../sdk/tests/integration/l1l3Bridger.test.ts | 6 +- .../parentToChildMessageCreator.test.ts | 2 +- .../parentToChildMessageGasEstimator.test.ts | 2 +- .../tests/integration/retryableData.test.ts | 2 +- packages/sdk/tests/integration/sanity.test.ts | 2 +- .../tests/integration/sendChildmsg.test.ts | 2 +- .../tests/integration/standarderc20.test.ts | 2 +- packages/sdk/tests/integration/testHelpers.ts | 2 +- packages/sdk/tests/integration/weth.test.ts | 2 +- packages/sdk/{scripts => tests}/testSetup.ts | 4 +- 33 files changed, 32 insertions(+), 1026 deletions(-) delete mode 100755 packages/sdk/scripts/builder delete mode 100644 packages/sdk/scripts/cancelRetryable.ts delete mode 100644 packages/sdk/scripts/checkRetryableStatus.ts delete mode 100644 packages/sdk/scripts/cleanCompileContracts.ts delete mode 100644 packages/sdk/scripts/deployStandard.ts rename packages/sdk/scripts/{genAbi.js => genAbi.ts} (80%) delete mode 100644 packages/sdk/scripts/getCLargs.ts delete mode 100644 packages/sdk/scripts/instantiate_bridge.ts delete mode 100644 packages/sdk/scripts/lib.ts delete mode 100644 packages/sdk/scripts/postProcessDocs.js delete mode 100644 packages/sdk/scripts/redeemRetryable.ts delete mode 100644 packages/sdk/scripts/scrap.ts delete mode 100644 packages/sdk/scripts/sendL2SignedMsg.ts delete mode 100644 packages/sdk/scripts/setArbCustomGateways.ts delete mode 100644 packages/sdk/scripts/setStandardGateways.ts delete mode 100644 packages/sdk/scripts/upgrade_weth.ts delete mode 100644 packages/sdk/scripts/util.ts rename packages/sdk/{scripts => tests}/testSetup.ts (97%) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index de5855ad59..7d7b3b3775 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -56,7 +56,7 @@ jobs: - name: Lint sdk run: | yarn gen:abi - yarn build --reporter-options output=$TEST_PATH/sdk.xml + yarn build yarn lint --format junit -o $TEST_PATH/sdk-lint.xml - name: Upload build artifacts diff --git a/packages/sdk/package.json b/packages/sdk/package.json index f6c17b6cfd..0e47807575 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -25,12 +25,12 @@ "scripts": { "audit:ci": "audit-ci --config ./audit-ci.jsonc", "prepare": "yarn run gen:abi", - "gen:abi": "node ./scripts/genAbi.js", + "gen:abi": "ts-node ./scripts/genAbi.ts", "gen:network": "ts-node ./scripts/genNetwork.ts", "prepublishOnly": "yarn build && yarn format", "preversion": "yarn lint", "prebuild": "yarn gen:abi", - "build": "./scripts/builder", + "build": "rm -rf dist && tsc -p tsconfig.json", "watch": "tsc --watch", "test": "mocha", "test:coverage": "nyc mocha", diff --git a/packages/sdk/scripts/builder b/packages/sdk/scripts/builder deleted file mode 100755 index 62c9e3894f..0000000000 --- a/packages/sdk/scripts/builder +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -rm -rf ./dist -tsc diff --git a/packages/sdk/scripts/cancelRetryable.ts b/packages/sdk/scripts/cancelRetryable.ts deleted file mode 100644 index 939a341f35..0000000000 --- a/packages/sdk/scripts/cancelRetryable.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import { ContractReceipt } from '@ethersproject/contracts' - -import { instantiateBridge } from './instantiate_bridge' -import args from './getCLargs' -import { L1TransactionReceipt } from '../src/lib/message/ParentTransaction' - -if (!args.txid) { - throw new Error('Include txid (--txid 0xmytxid)') -} - -const l1Txn: string | ContractReceipt = args.txid as string - -;(async () => { - const { l1Signer, l2Signer } = await instantiateBridge() - const l1Receipt = new L1TransactionReceipt( - await l1Signer.provider!.getTransactionReceipt(l1Txn) - ) - const message = await l1Receipt.getL1ToL2Message(l2Signer) - const res = await message.cancel() - const rec = await res.wait() - console.log('done:', rec) - console.log(rec.status === 1 ? 'success!' : 'failed...') -})() diff --git a/packages/sdk/scripts/checkRetryableStatus.ts b/packages/sdk/scripts/checkRetryableStatus.ts deleted file mode 100644 index cb0b89bbe2..0000000000 --- a/packages/sdk/scripts/checkRetryableStatus.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import { checkRetryableStatus } from './lib' - -import args from './getCLargs' - -if (!args.txid) { - throw new Error('Include txid (--txid 0xmytxid)') -} -const txId = args.txid as string - -if (!txId) { - throw new Error('Need to set an L1 hash') -} - -checkRetryableStatus(txId) - .then(() => process.exit(0)) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/packages/sdk/scripts/cleanCompileContracts.ts b/packages/sdk/scripts/cleanCompileContracts.ts deleted file mode 100644 index 7b5974bb25..0000000000 --- a/packages/sdk/scripts/cleanCompileContracts.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { getPackagePath } from './util' -// this breaks on browsers, we can instead do a dynamic require to surface the error cleanly? -import { execSync } from 'child_process' - -const cleanCompileContracts = async () => { - const arbosPath = getPackagePath('arbos-precompiles') - const ethBridgePath = getPackagePath('arb-bridge-eth') - const peripheralsPath = getPackagePath('arb-bridge-eth') - - console.log('Clean building arbos') - execSync(`cd ${arbosPath} && yarn clean:build`) - - console.log('Clean building ethbridge') - execSync(`cd ${ethBridgePath} && yarn clean:build`) - - console.log('Clean building peripherals') - execSync(`cd ${peripheralsPath} && yarn clean:build`) - - console.log('All clean and all built.') -} - -cleanCompileContracts() - .then(() => process.exit(process.exitCode)) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/packages/sdk/scripts/deployStandard.ts b/packages/sdk/scripts/deployStandard.ts deleted file mode 100644 index 8dacd102c9..0000000000 --- a/packages/sdk/scripts/deployStandard.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { instantiateBridge } from './instantiate_bridge' -import { loadEnv } from '../src/lib/utils/env' -import args from './getCLargs' -import { constants, BigNumber, utils } from 'ethers' -import { MultiCaller } from '../src' -import axios from 'axios' -import prompt from 'prompts' - -loadEnv() - -const privKey = process.env.PRIVKEY as string -if (!privKey) { - throw new Error('Set PRIVKEY env variable') -} - -if (!args.l1TokenAddress) { - throw new Error( - 'Include l1TokenAddress arg (--l1TokenAddress 0xmytokenaddress)' - ) -} -const { l1TokenAddress: l1TokenAddress } = args - -const main = async () => { - const { l1Signer, erc20Bridger, l2Signer } = await instantiateBridge( - privKey, - privKey - ) - const l1Provider = l1Signer.provider! - const l2Provider = l2Signer.provider! - const gatewayAddress = await erc20Bridger.getParentGatewayAddress( - l1TokenAddress, - l1Provider - ) - const l1SignerAddr = await l1Signer.getAddress() - - /* Looks like an L1 token: */ - const multicaller = await MultiCaller.fromProvider(l1Provider) - let l1TokenData: { allowance: BigNumber | undefined } - try { - l1TokenData = ( - await multicaller.getTokenData([l1TokenAddress], { - allowance: { - owner: l1SignerAddr, - spender: gatewayAddress, - }, - }) - )[0] - } catch (err) { - console.warn(`${l1TokenAddress} doesn't look like an L1 ERC20 token`) - throw err - } - - /** Check if disabled */ - const isDisabled = await erc20Bridger.isDepositDisabled( - l1TokenAddress, - l1Provider - ) - if (isDisabled) { - console.log(`Deploying ${l1TokenAddress} is currently disabled`) - return - } - - /* Handle warning tokens */ - const warningTokens = ( - await axios.get( - 'https://raw.githubusercontent.com/OffchainLabs/arb-token-lists/master/src/WarningList/warningTokens.json' - ) - ).data - const warningToken = warningTokens[l1TokenAddress.toLowerCase()] - if (warningToken) { - const description = (() => { - switch (warningToken.type) { - case 0: - return 'a supply rebasing token' - case 1: - return 'an interest accruing token' - default: - return 'a non-standard ERC20 token' - } - })() - console.log() - console.log( - `${l1TokenAddress} is ${description}; it will likely have unusual behavior when deployed as as standard token to Arbitrum. It is not recommended that you deploy it. (See https://developer.offchainlabs.com/docs/bridging_assets for more info.)` - ) - console.log() - - const res = await prompt({ - type: 'confirm', - name: 'value', - message: 'Are you sure you would like to proceed?', - initial: true, - }) - if (!res.value) { - console.log('Good decision; terminating 👋') - return - } - } - - /* check that you have some eth */ - const walletBal = await l1Provider.getBalance(l1SignerAddr) - if (walletBal.eq(constants.Zero)) { - throw new Error(`${l1SignerAddr} has no Ether to pay for gas`) - } - - /* check token not yet deployed */ - const l2TokenAddress = await erc20Bridger.getChildErc20Address( - l1TokenAddress, - l1Provider - ) - if (l2TokenAddress === constants.AddressZero) { - throw new Error(`${l1TokenAddress} can't be bridged`) - } - - if ((await l2Provider.getCode(l2TokenAddress)).length > 2) { - throw new Error( - `${l1TokenAddress} already deployed on L2 at ${l2TokenAddress}` - ) - } - - /* set allowance */ - const amount = BigNumber.from(0) - const approveAmount = BigNumber.from(1000) - if (!l1TokenData.allowance) { - throw new Error(`unable to fetch allowance of ${l1TokenAddress}`) - } - if (l1TokenData.allowance.lt(approveAmount)) { - console.log('Setting allowance on gateway') - - const res = await erc20Bridger.approveToken({ - erc20L1Address: l1TokenAddress, - l1Signer: l1Signer, - amount, - }) - const rec = await res.wait(2) - console.log( - `Allowance successfully set — L1 tx hash: ${rec.transactionHash}` - ) - } - // const depositParams = { - // erc20L1Address: l1TokenAddress, - // amount: BigNumber.from(0), - // } - /* check for required gas */ - const gasNeeded = await erc20Bridger.depositEstimateGas({ - amount, - erc20L1Address: l1TokenAddress, - l1Signer, - l2Provider: l2Provider, - }) - const price = await l2Provider.getGasPrice() - if (!price) { - console.log( - 'Warning: could not get gas price estimate; will try depositing anyway' - ) - } else { - const fee = price.mul(gasNeeded) - if (fee.gt(walletBal)) { - console.log( - `An estimated ${utils.formatEther( - fee - )} ether is needed for deposit; you only have ${utils.formatEther( - walletBal - )} ether. Will try depositing anyway:` - ) - } - } - - console.log('Depositing / deploying standard token contract:') - - const res = await erc20Bridger.deposit({ - amount, - erc20L1Address: l1TokenAddress, - l1Signer, - l2Provider, - }) - const rec = await res.wait(2) - console.log(`L1 deposit txn confirmed — L1 txn hash: ${rec.transactionHash}`) - const message = await rec.getL1ToL2Message(l2Provider) - - await message.waitForStatus(2) - console.log(`Done; your token is deployed on L2 at ${l2TokenAddress}`) -} - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/packages/sdk/scripts/genAbi.js b/packages/sdk/scripts/genAbi.ts similarity index 80% rename from packages/sdk/scripts/genAbi.js rename to packages/sdk/scripts/genAbi.ts index 1e3940a0a6..736ff7f3cf 100644 --- a/packages/sdk/scripts/genAbi.js +++ b/packages/sdk/scripts/genAbi.ts @@ -1,17 +1,19 @@ -const { runTypeChain, glob } = require('typechain') -const { execSync } = require('child_process') -const { unlinkSync, existsSync, rmSync } = require('fs') +import { runTypeChain, glob } from 'typechain' +import { execSync } from 'child_process' +import { unlinkSync, rmSync } from 'fs' +import * as path from 'path' -const getPackagePath = packageName => { +const ABI_PATH = path.resolve(__dirname, '../src/lib/abi') + +const getPackagePath = (packageName: string): string => { const path = require.resolve(`${packageName}/package.json`) return path.substr(0, path.indexOf('package.json')) } async function main() { - if (existsSync('./src/lib/abi/')) { - console.log('Removing previously generated ABIs.\n') - rmSync('./src/lib/abi/', { recursive: true }) - } + console.log('Removing previously generated ABIs.\n') + rmSync(`${ABI_PATH}`, { recursive: true, force: true }) + rmSync(`${ABI_PATH}/classic`, { recursive: true, force: true }) const cwd = process.cwd() @@ -59,7 +61,7 @@ async function main() { cwd, filesToProcess: nitroFiles, allFiles: nitroFiles, - outDir: './src/lib/abi/', + outDir: `${ABI_PATH}`, target: 'ethers-v5', }) @@ -72,13 +74,13 @@ async function main() { cwd, filesToProcess: classicFiles, allFiles: classicFiles, - outDir: './src/lib/abi/classic', + outDir: `${ABI_PATH}/classic`, target: 'ethers-v5', }) // we delete the index file since it doesn't play well with tree shaking - unlinkSync(`${cwd}/src/lib/abi/index.ts`) - unlinkSync(`${cwd}/src/lib/abi/classic/index.ts`) + unlinkSync(`${ABI_PATH}/index.ts`) + unlinkSync(`${ABI_PATH}/classic/index.ts`) console.log('Typechain generated') } diff --git a/packages/sdk/scripts/getCLargs.ts b/packages/sdk/scripts/getCLargs.ts deleted file mode 100644 index ec7f669b3d..0000000000 --- a/packages/sdk/scripts/getCLargs.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import yargs from 'yargs/yargs' - -const argv = yargs(process.argv.slice(2)) - .options({ - address: { - type: 'string', - }, - l1TokenAddress: { - type: 'string', - }, - txid: { - type: 'string', - }, - networkID: { - type: 'number', - }, - }) - .parseSync() - -export default argv diff --git a/packages/sdk/scripts/instantiate_bridge.ts b/packages/sdk/scripts/instantiate_bridge.ts deleted file mode 100644 index d73719755a..0000000000 --- a/packages/sdk/scripts/instantiate_bridge.ts +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import { JsonRpcProvider } from '@ethersproject/providers' -import { Wallet } from '@ethersproject/wallet' -import { loadEnv } from '../src/lib/utils/env' - -import args from './getCLargs' -import { EthBridger, InboxTools, Erc20Bridger } from '../src' -import { - ArbitrumNetwork, - getArbitrumNetwork, -} from '../src/lib/dataEntities/networks' -import { Signer } from 'ethers' -import { AdminErc20Bridger } from '../src/lib/assetBridger/erc20Bridger' - -loadEnv() - -const arbKey = process.env['ARB_KEY'] as string -const ethKey = process.env['ETH_KEY'] as string - -const defaultNetworkId = 421614 - -export const instantiateBridge = async ( - l1PkParam?: string, - l2PkParam?: string -): Promise<{ - l2Network: ArbitrumNetwork - l1Signer: Signer - l2Signer: Signer - erc20Bridger: Erc20Bridger - ethBridger: EthBridger - adminErc20Bridger: AdminErc20Bridger - inboxTools: InboxTools -}> => { - if (!l1PkParam && !ethKey) { - throw new Error('need ARB_KEY var') - } - if (!l2PkParam && !arbKey) { - throw new Error('need ARB_KEY var') - } - - let l2NetworkID = args.networkID - if (!l2NetworkID) { - console.log( - 'No networkID command line arg provided; using network', - defaultNetworkId - ) - - l2NetworkID = defaultNetworkId - } - - const l2Network = await getArbitrumNetwork(l2NetworkID) - - const l1Rpc = (() => { - if (l2NetworkID === 42161) return process.env['MAINNET_RPC'] as string - if (l2NetworkID === 421614) return process.env['SEPOLIA_RPC'] as string - if (l2NetworkID === 1338) return 'http://127.0.0.1:8545/' - throw new Error( - 'L1 rpc url not set (see .env.sample or networks.ts) or chain id not supported' - ) - })() - const l2Rpc = (() => { - if (l2NetworkID === 42161) - return process.env['ARB_ONE_RPC'] || 'https://arb1.arbitrum.io/rpc' - if (l2NetworkID === 421614) - return ( - process.env['SEPOLIA_ROLLUP_TESTNET_RPC'] || - 'https://sepolia-rollup.arbitrum.io/rpc' - ) - throw new Error( - 'L2 rpc url not set (see .env.sample or networks.ts) or chain id not supported' - ) - })() - - const ethProvider = new JsonRpcProvider(l1Rpc) - const arbProvider = new JsonRpcProvider(l2Rpc) - - const l1Signer = (() => { - if (l1PkParam) { - return new Wallet(l1PkParam, ethProvider) - } else if (ethKey) { - return new Wallet(ethKey, ethProvider) - } else { - throw new Error('impossible path') - } - })() - - const l2Signer = (() => { - if (l2PkParam) { - return new Wallet(l2PkParam, arbProvider) - } else if (arbKey) { - return new Wallet(arbKey, arbProvider) - } else { - throw new Error('impossible path') - } - })() - - console.log('') - console.log('**** Bridger instantiated w/ address', l1Signer.address, '****') - console.log('') - - const erc20Bridger = new Erc20Bridger(l2Network) - const adminErc20Bridger = new AdminErc20Bridger(l2Network) - const ethBridger = new EthBridger(l2Network) - const inboxTools = new InboxTools(l1Signer, l2Network) - - return { - l2Network, - l1Signer, - l2Signer, - erc20Bridger: erc20Bridger, - ethBridger, - adminErc20Bridger, - inboxTools, - } -} diff --git a/packages/sdk/scripts/lib.ts b/packages/sdk/scripts/lib.ts deleted file mode 100644 index 4b0191f90e..0000000000 --- a/packages/sdk/scripts/lib.ts +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import { ContractReceipt } from '@ethersproject/contracts' - -import { ERC20__factory } from '../src/lib/abi/factories/ERC20__factory' -import { L1ToL2MessageStatus } from '../src/lib/message/ParentToChildMessage' -import { L1TransactionReceipt } from '../src/lib/message/ParentTransaction' -import { testSetup } from '../scripts/testSetup' - -export const setStandardGateWays = async ( - tokens: string[] -): Promise => { - return setGateWays(tokens, 'standard') -} -export const setArbCustomGateways = async ( - tokens: string[] -): Promise => { - return setGateWays(tokens, 'arbCustom') -} - -export const setGateWays = async ( - tokens: string[], - type: 'standard' | 'arbCustom', - overrideGateways: string[] = [] -): Promise => { - const { adminErc20Bridger, parentSigner, childChain, childSigner } = - await testSetup() - const parentProvider = parentSigner.provider! - const childProvider = childSigner.provider! - if (tokens.length === 0) { - throw new Error('Include some tokens to set') - } - if ( - overrideGateways.length > 0 && - overrideGateways.length !== tokens.length - ) { - throw new Error('Token/Gateway arrays are different lengths') - } - console.log('Setting', tokens.length, 'tokens') - - for (const tokenAddress of tokens) { - try { - const token = await ERC20__factory.connect(tokenAddress, parentProvider) - console.warn('calling name for ', tokenAddress) - - const symbol = await token.symbol() - const name = await token.name() - const decimals = await token.decimals() - console.log(symbol, name, decimals) - - const looksGood = - typeof symbol === 'string' && - typeof decimals === 'number' && - typeof name === 'string' && - decimals > 0 && - symbol.length > 0 && - name.length > 0 - - if (!looksGood) { - throw new Error(`${tokenAddress} doesn't look like an L1 erc20...`) - } - } catch (err) { - console.warn('err', err) - - throw new Error(`${tokenAddress} doesn't look like an L1 erc20...`) - } - } - console.log('L1 sanity checks passed...') - const gateways = (() => { - if (overrideGateways.length > 0) { - return overrideGateways - } else if (type === 'standard') { - return tokens.map(() => childChain.tokenBridge.parentErc20Gateway) - } else if (type === 'arbCustom') { - return tokens.map(() => childChain.tokenBridge.parentCustomGateway) - } else { - throw new Error('Unhandled else case') - } - })() - - const res = await adminErc20Bridger.setGateways( - parentSigner, - childProvider, - gateways.map((g, i) => ({ - tokenAddr: tokens[i], - gatewayAddr: gateways[i], - })) - ) - console.log('Getting gateway(s)', res) - const rec = await res.wait() - console.log('Done', rec) - - if (rec.status !== 1) { - throw new Error(`SetGateways failed on L1 ${rec.transactionHash}`) - } - - console.log('redeeming retryable ticket:') - const l2Tx = (await rec.getParentToChildMessages(childSigner))[0] - if (!l2Tx) throw new Error('No l1 to l2 message found.') - const messageRes = await l2Tx.waitForStatus() - if (messageRes.status === L1ToL2MessageStatus.FUNDS_DEPOSITED_ON_L2) { - const redeemRes = await l2Tx.redeem() - const redeemRec = await redeemRes.wait() - console.log('Done redeeming:', redeemRec) - console.log(redeemRec.status === 1 ? ' success!' : 'failed...') - return redeemRec - } else throw new Error(`Unpexpected message status: ${messageRes.status}.`) -} - -export const checkRetryableStatus = async (l1Hash: string): Promise => { - const { parentSigner, childSigner } = await testSetup() - const parentProvider = parentSigner.provider! - const childProvider = childSigner.provider! - const rec = await parentProvider.getTransactionReceipt(l1Hash) - if (!rec) throw new Error('L1 tx not found!') - const messages = await new L1TransactionReceipt(rec).getParentToChildMessages( - childProvider - ) - - for (const message of messages) { - if (!message) throw new Error('no seq nums') - - const messageStatus = await message.waitForStatus() - - const autoRedeemTxnRec = await message.getAutoRedeemAttempt() - const autoRedeemTxnHash = autoRedeemTxnRec - ? autoRedeemTxnRec.transactionHash - : null - - const retryableTicketId = message.retryableCreationId - const retryableTicketRec = - messageStatus.status === L1ToL2MessageStatus.REDEEMED - ? messageStatus.l2TxReceipt - : null - - console.log('*** autoRedeemTxnHash', autoRedeemTxnHash) - console.log( - '*** autoRedeemTxn status', - autoRedeemTxnRec ? autoRedeemTxnRec.status : autoRedeemTxnRec - ) - if (autoRedeemTxnRec && autoRedeemTxnRec.status !== 1) { - console.log('**** autoRedeemTxn receipt', autoRedeemTxnHash) - } - - console.log('*** retryableTicketId', retryableTicketId) - console.log( - '*** retryableTicket status', - retryableTicketRec ? retryableTicketRec.status : messageStatus.status - ) - if (retryableTicketRec) { - console.log( - '**** retryableTicket receipt', - retryableTicketRec.transactionHash - ) - } - } -} diff --git a/packages/sdk/scripts/postProcessDocs.js b/packages/sdk/scripts/postProcessDocs.js deleted file mode 100644 index c8d5302493..0000000000 --- a/packages/sdk/scripts/postProcessDocs.js +++ /dev/null @@ -1,90 +0,0 @@ -const glob = require('glob') -const { readFile, writeFile, unlink, renameSync } = require('fs') - -// The index file automatically generated by typedoc-plugin-markdown -// only contains the list of modules of the package. -// We'll add an introduction paragraph to that index file -// and use metadata to place it in the first position. -const indexIntroContents = `--- -sidebar_position: 1 ---- - -# Arbitrum SDK - -[Arbitrum SDK](https://github.com/OffchainLabs/arbitrum-sdk) is a typescript library for client-side interactions with Arbitrum. It provides common helper functionality as well as access to the underlying smart contract interfaces. - -Below is a list of modules of the library. See the [tutorials](https://github.com/OffchainLabs/arbitrum-tutorials) for further examples of how to use these classes. -` - -// Traverse all typedoc generated md files -glob('./docs/**/*', function (err, res) { - if (err) { - console.log('Error', err) - } else { - for (const path of res) { - if (!path.endsWith('.md')) continue - - // Remove README file - if (path.includes('README.md')) { - unlink(path, function (err) { - if (err) { - console.log(err) - return - } - }) - continue - } - - // Set the new index file - if (path.includes('modules.md')) { - // Renaming the file to serve it as the index - const indexPath = path.replace('modules', 'index') - renameSync(path, indexPath, function (err) { - if (err) { - console.log(err) - return - } - }) - - // Modifying the file contents - // - Remove the automatically generated title - // - Add metadata, a new title + an intro text - readFile(indexPath, 'utf-8', function (err, contents) { - if (err) { - console.log(err) - return - } - - // Remove the automatically generated title - const [, ...linesWithoutFirstLine] = contents.split('\n') - const newFileContent = linesWithoutFirstLine.join('\n').trim() - - // Write the updated contents to the file - writeFile( - indexPath, - `${indexIntroContents}\n${newFileContent}`, - 'utf-8', - function (err) { - if (err) console.warn('Error', err) - } - ) - }) - continue - } - - // Traverse all files - readFile(path, 'utf-8', function (err, contents) { - if (err) { - console.log(err) - return - } - - // Fix JSX md rendering breaking tags (only tags break docusaurus, so we keep the rest): - const replaced = contents.replace(//g, '<T>') - writeFile(path, replaced, 'utf-8', function (err) { - if (err) console.warn('Error', err) - }) - }) - } - } -}) diff --git a/packages/sdk/scripts/redeemRetryable.ts b/packages/sdk/scripts/redeemRetryable.ts deleted file mode 100644 index b79cd89f0e..0000000000 --- a/packages/sdk/scripts/redeemRetryable.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import { ContractReceipt } from '@ethersproject/contracts' - -import { testSetup } from '../scripts/testSetup' -import args from './getCLargs' -import { L1TransactionReceipt } from '../src/lib/message/ParentTransaction' -import { L1ToL2MessageStatus, L1ToL2MessageWriter } from '../src' -import { fundL2 } from '../integration_test/testHelpers' - -if (!args.txid) { - throw new Error('Include txid (--txid 0xmytxid)') -} - -const l1Txn: string | ContractReceipt = args.txid as string - -if (!l1Txn) { - throw new Error('Need to set l1 txn hash') -} - -;(async () => { - const { parentSigner, childSigner } = await testSetup() - // TODO: Should use the PRIVKEY envvar signer directly - fundL2(childSigner) - const l1Provider = parentSigner.provider! - const l1Receipt = new L1TransactionReceipt( - await l1Provider.getTransactionReceipt(l1Txn) - ) - const l1ToL2Message = await l1Receipt.getL1ToL2Message(childSigner) - if (l1ToL2Message instanceof L1ToL2MessageWriter) { - const redeemStatus = (await l1ToL2Message.waitForStatus()).status - if (redeemStatus == L1ToL2MessageStatus.REDEEMED) { - const redeemTx = await l1ToL2Message.getSuccessfulRedeem() - console.log(`Already redeemed ${redeemTx!.transactionHash}`) - return - } - const res = await l1ToL2Message.redeem() - const rec = await res.wait() - console.log('done:', rec) - console.log(rec.status === 1 ? 'success!' : 'failed...') - } -})() diff --git a/packages/sdk/scripts/scrap.ts b/packages/sdk/scripts/scrap.ts deleted file mode 100644 index f0f588354c..0000000000 --- a/packages/sdk/scripts/scrap.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -// import { instantiateBridge } from './instantiate_bridge' -;('use strict') -;(async () => { - // const bridge = await instantiateBridge() - /*do stuff here */ -})() diff --git a/packages/sdk/scripts/sendL2SignedMsg.ts b/packages/sdk/scripts/sendL2SignedMsg.ts deleted file mode 100644 index 08ccc8966f..0000000000 --- a/packages/sdk/scripts/sendL2SignedMsg.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -;('use strict') - -import { BigNumber } from 'ethers' -import { InboxTools } from '../src/lib/inbox/inbox' -import { getArbitrumNetwork } from '../src/lib/dataEntities/networks' -import { testSetup } from '../scripts/testSetup' -const sendSignedMsg = async () => { - const { l1Deployer, l2Deployer } = await testSetup() - const l2Network = await getArbitrumNetwork(await l2Deployer.getChainId()) - const inbox = new InboxTools(l1Deployer, l2Network) - const message = { - to: await l2Deployer.getAddress(), - value: BigNumber.from(0), - data: '0x12', - } - const signedTx = await inbox.signChildChainTx(message, l2Deployer) - await inbox.sendChildChainSignedTx(signedTx) -} - -sendSignedMsg() - .then(() => { - console.log('done') - }) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/packages/sdk/scripts/setArbCustomGateways.ts b/packages/sdk/scripts/setArbCustomGateways.ts deleted file mode 100644 index 40cc4dddb6..0000000000 --- a/packages/sdk/scripts/setArbCustomGateways.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import { setArbCustomGateways } from './lib' -import args from './getCLargs' - -if (!args.address) { - throw new Error('Include token address (--address 0xmyaddress)') -} - -const tokens = [args.address as string] -if (tokens.length === 0) { - throw new Error('Include some tokens to set') -} - -setArbCustomGateways(tokens).then(() => { - console.log('done') -}) diff --git a/packages/sdk/scripts/setStandardGateways.ts b/packages/sdk/scripts/setStandardGateways.ts deleted file mode 100644 index 9965b61b90..0000000000 --- a/packages/sdk/scripts/setStandardGateways.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import { setStandardGateWays } from './lib' -import args from './getCLargs' - -if (!args.address) { - throw new Error('Include token address (--address 0xmyaddress)') -} - -const tokens: string[] = [args.address as string] -if (tokens.length === 0) { - throw new Error('Include some tokens to set') -} - -setStandardGateWays(tokens).then(() => { - console.log('done') -}) diff --git a/packages/sdk/scripts/upgrade_weth.ts b/packages/sdk/scripts/upgrade_weth.ts deleted file mode 100644 index efbb69c386..0000000000 --- a/packages/sdk/scripts/upgrade_weth.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2021, Offchain Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* eslint-env node */ -'use strict' - -import { AeWETH__factory } from '../src/lib/abi/factories/AeWETH__factory' -import { TransparentUpgradeableProxy__factory } from '../src/lib/abi/factories/TransparentUpgradeableProxy__factory' - -import { instantiateBridge } from './instantiate_bridge' - -const main = async () => { - const { l2Signer, l2Network } = await instantiateBridge() - - const aeWeth = new AeWETH__factory(l2Signer) - const res = await aeWeth.deploy() - await res.deployTransaction.wait() - const logicAddress = res.address - - console.log('aeWeth logic deployed to ', logicAddress) - - const connectedProxy = TransparentUpgradeableProxy__factory.connect( - l2Network.tokenBridge.childWeth, - l2Signer - ) - const upgradeRes = await connectedProxy.upgradeTo(logicAddress) - const upgradeRec = await upgradeRes.wait() - - console.log('successfully upgraded WETH logic', upgradeRec) -} - -// const initWETH = async () => { -// const { bridge, l2Network } = await instantiateBridge() -// const { l2Signer } = bridge.l2Bridge - -// const aeWeth = AeWETH__factory.connect(l2Network.tokenBridge.childWeth, l2Signer) -// const res = await aeWeth.initialize( -// 'Wrapped Ether', -// 'WETH', -// 18, -// l2Network.tokenBridge.childWethGateway, -// l2Network.tokenBridge.parentWeth -// ) - -// const rec = await res.wait() -// console.warn('initialized weth', rec) -// } - -main() - .then(() => process.exit(0)) - .catch(error => { - console.error(error) - process.exit(1) - }) diff --git a/packages/sdk/scripts/util.ts b/packages/sdk/scripts/util.ts deleted file mode 100644 index 2705452673..0000000000 --- a/packages/sdk/scripts/util.ts +++ /dev/null @@ -1,6 +0,0 @@ -// we don't expose this method in shared lib so we don't risk breaking this -// method because of a dependency needed in lib -export const getPackagePath = (packageName: string): string => { - const path = require.resolve(`${packageName}/package.json`) - return path.substr(0, path.indexOf('package.json')) -} diff --git a/packages/sdk/tests/integration/childTransactionReceipt.test.ts b/packages/sdk/tests/integration/childTransactionReceipt.test.ts index fb54418aa0..6651b0dc3e 100644 --- a/packages/sdk/tests/integration/childTransactionReceipt.test.ts +++ b/packages/sdk/tests/integration/childTransactionReceipt.test.ts @@ -29,7 +29,7 @@ import { ChildTransactionReceipt } from '../../src' import { JsonRpcProvider } from '@ethersproject/providers' import { BigNumber, Wallet } from 'ethers' import { parseEther } from 'ethers/lib/utils' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' async function waitForL1BatchConfirmations( arbTxReceipt: ChildTransactionReceipt, diff --git a/packages/sdk/tests/integration/custom-fee-token/customFeeTokenTestHelpers.ts b/packages/sdk/tests/integration/custom-fee-token/customFeeTokenTestHelpers.ts index a6e04a79d2..b84a8289b5 100644 --- a/packages/sdk/tests/integration/custom-fee-token/customFeeTokenTestHelpers.ts +++ b/packages/sdk/tests/integration/custom-fee-token/customFeeTokenTestHelpers.ts @@ -5,7 +5,7 @@ import { testSetup as _testSetup, config, getLocalNetworksFromFile, -} from '../../../scripts/testSetup' +} from '../../testSetup' import { Erc20Bridger, EthBridger } from '../../../src' import { ERC20__factory } from '../../../src/lib/abi/factories/ERC20__factory' import { getNativeTokenDecimals } from '../../../src/lib/utils/lib' diff --git a/packages/sdk/tests/integration/customerc20.test.ts b/packages/sdk/tests/integration/customerc20.test.ts index 29c1281b22..8376b83ece 100644 --- a/packages/sdk/tests/integration/customerc20.test.ts +++ b/packages/sdk/tests/integration/customerc20.test.ts @@ -44,7 +44,7 @@ import { assertArbitrumNetworkHasTokenBridge, } from '../../src/lib/dataEntities/networks' import { AdminErc20Bridger } from '../../src/lib/assetBridger/erc20Bridger' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { ERC20__factory } from '../../src/lib/abi/factories/ERC20__factory' import { isArbitrumNetworkWithCustomFeeToken } from './custom-fee-token/customFeeTokenTestHelpers' diff --git a/packages/sdk/tests/integration/eth.test.ts b/packages/sdk/tests/integration/eth.test.ts index dcaa576092..63ed9d0fac 100644 --- a/packages/sdk/tests/integration/eth.test.ts +++ b/packages/sdk/tests/integration/eth.test.ts @@ -32,7 +32,7 @@ import { ChildToParentMessage } from '../../src/lib/message/ChildToParentMessage import { ChildToParentMessageStatus } from '../../src/lib/dataEntities/message' import { ChildTransactionReceipt } from '../../src/lib/message/ChildTransaction' import { ParentToChildMessageStatus } from '../../src/lib/message/ParentToChildMessage' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { isArbitrumNetworkWithCustomFeeToken } from './custom-fee-token/customFeeTokenTestHelpers' import { ERC20__factory } from '../../src/lib/abi/factories/ERC20__factory' import { itOnlyWhenEth } from './custom-fee-token/mochaExtensions' diff --git a/packages/sdk/tests/integration/l1l3Bridger.test.ts b/packages/sdk/tests/integration/l1l3Bridger.test.ts index f126e379ff..e08bd18784 100644 --- a/packages/sdk/tests/integration/l1l3Bridger.test.ts +++ b/packages/sdk/tests/integration/l1l3Bridger.test.ts @@ -1,8 +1,4 @@ -import { - getLocalNetworksFromFile, - getSigner, - testSetup, -} from '../../scripts/testSetup' +import { getLocalNetworksFromFile, getSigner, testSetup } from '../testSetup' import { Address, Erc20Bridger, diff --git a/packages/sdk/tests/integration/parentToChildMessageCreator.test.ts b/packages/sdk/tests/integration/parentToChildMessageCreator.test.ts index 0474878d4a..086e0e7403 100644 --- a/packages/sdk/tests/integration/parentToChildMessageCreator.test.ts +++ b/packages/sdk/tests/integration/parentToChildMessageCreator.test.ts @@ -19,7 +19,7 @@ import { expect } from 'chai' import { providers, utils } from 'ethers' import { fundParentSigner, skipIfMainnet } from './testHelpers' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { ParentToChildMessageCreator } from '../../src/lib/message/ParentToChildMessageCreator' import { ParentToChildMessageStatus } from '../../src/lib/message/ParentToChildMessage' diff --git a/packages/sdk/tests/integration/parentToChildMessageGasEstimator.test.ts b/packages/sdk/tests/integration/parentToChildMessageGasEstimator.test.ts index 56dce2fe97..1d60a1d9bd 100644 --- a/packages/sdk/tests/integration/parentToChildMessageGasEstimator.test.ts +++ b/packages/sdk/tests/integration/parentToChildMessageGasEstimator.test.ts @@ -20,7 +20,7 @@ import { expect } from 'chai' import { BigNumber } from 'ethers' import { skipIfMainnet } from './testHelpers' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { ParentToChildMessageGasEstimator } from '../../src/lib/message/ParentToChildMessageGasEstimator' import { itOnlyWhenEth, diff --git a/packages/sdk/tests/integration/retryableData.test.ts b/packages/sdk/tests/integration/retryableData.test.ts index 4797a1e823..6d527428ac 100644 --- a/packages/sdk/tests/integration/retryableData.test.ts +++ b/packages/sdk/tests/integration/retryableData.test.ts @@ -23,7 +23,7 @@ import { TestERC20__factory } from '../../src/lib/abi/factories/TestERC20__facto import { fundParentSigner, skipIfMainnet } from './testHelpers' import { RetryableDataTools } from '../../src' import { Wallet } from 'ethers' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { parseEther, randomBytes } from 'ethers/lib/utils' import { Inbox__factory } from '../../src/lib/abi/factories/Inbox__factory' import { GasOverrides } from '../../src/lib/message/ParentToChildMessageGasEstimator' diff --git a/packages/sdk/tests/integration/sanity.test.ts b/packages/sdk/tests/integration/sanity.test.ts index b1722e1c1d..df08e5c15d 100644 --- a/packages/sdk/tests/integration/sanity.test.ts +++ b/packages/sdk/tests/integration/sanity.test.ts @@ -27,7 +27,7 @@ import { L1CustomGateway__factory } from '../../src/lib/abi/factories/L1CustomGa import { L2ERC20Gateway__factory } from '../../src/lib/abi/factories/L2ERC20Gateway__factory' import { L1ERC20Gateway__factory } from '../../src/lib/abi/factories/L1ERC20Gateway__factory' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { randomBytes, hexlify } from 'ethers/lib/utils' import { itOnlyWhenEth } from './custom-fee-token/mochaExtensions' diff --git a/packages/sdk/tests/integration/sendChildmsg.test.ts b/packages/sdk/tests/integration/sendChildmsg.test.ts index a064c2562e..7504bd62f3 100644 --- a/packages/sdk/tests/integration/sendChildmsg.test.ts +++ b/packages/sdk/tests/integration/sendChildmsg.test.ts @@ -23,7 +23,7 @@ import { getArbitrumNetwork, ArbitrumNetwork, } from '../../src/lib/dataEntities/networks' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { greeter } from './helper/greeter' import { expect } from 'chai' import { AdminErc20Bridger } from '../../src/lib/assetBridger/erc20Bridger' diff --git a/packages/sdk/tests/integration/standarderc20.test.ts b/packages/sdk/tests/integration/standarderc20.test.ts index f32f91c91e..c691c44637 100644 --- a/packages/sdk/tests/integration/standarderc20.test.ts +++ b/packages/sdk/tests/integration/standarderc20.test.ts @@ -34,7 +34,7 @@ import { ChildTransactionReceipt, } from '../../src' import { TestERC20 } from '../../src/lib/abi/TestERC20' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { ERC20__factory } from '../../src/lib/abi/factories/ERC20__factory' import { ARB_RETRYABLE_TX_ADDRESS, diff --git a/packages/sdk/tests/integration/testHelpers.ts b/packages/sdk/tests/integration/testHelpers.ts index 50e8b2c9a2..124b850ddd 100644 --- a/packages/sdk/tests/integration/testHelpers.ts +++ b/packages/sdk/tests/integration/testHelpers.ts @@ -23,7 +23,7 @@ import { BigNumber } from '@ethersproject/bignumber' import { JsonRpcProvider } from '@ethersproject/providers' import { parseEther } from 'ethers/lib/utils' -import { config, getSigner, testSetup } from '../../scripts/testSetup' +import { config, getSigner, testSetup } from '../testSetup' import { Signer, Wallet } from 'ethers' import { Erc20Bridger, ChildToParentMessageStatus } from '../../src' diff --git a/packages/sdk/tests/integration/weth.test.ts b/packages/sdk/tests/integration/weth.test.ts index 79c79e6cad..d79543b49a 100644 --- a/packages/sdk/tests/integration/weth.test.ts +++ b/packages/sdk/tests/integration/weth.test.ts @@ -29,7 +29,7 @@ import { } from './testHelpers' import { ParentToChildMessageStatus } from '../../src' import { Wallet } from 'ethers' -import { testSetup } from '../../scripts/testSetup' +import { testSetup } from '../testSetup' import { ERC20__factory } from '../../src/lib/abi/factories/ERC20__factory' import { describeOnlyWhenEth } from './custom-fee-token/mochaExtensions' diff --git a/packages/sdk/scripts/testSetup.ts b/packages/sdk/tests/testSetup.ts similarity index 97% rename from packages/sdk/scripts/testSetup.ts rename to packages/sdk/tests/testSetup.ts index 2967eaded0..597b0b511e 100644 --- a/packages/sdk/scripts/testSetup.ts +++ b/packages/sdk/tests/testSetup.ts @@ -38,8 +38,8 @@ import { approveParentCustomFeeToken, fundParentCustomFeeToken, isArbitrumNetworkWithCustomFeeToken, -} from '../tests/integration/custom-fee-token/customFeeTokenTestHelpers' -import { fundParentSigner } from '../tests/integration/testHelpers' +} from './integration/custom-fee-token/customFeeTokenTestHelpers' +import { fundParentSigner } from './integration/testHelpers' loadEnv()