Skip to content

Commit

Permalink
feat: update to arbitrum-orbit-sdk v0.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio-altr committed Oct 27, 2024
1 parent 3b47a3b commit 5ea3027
Show file tree
Hide file tree
Showing 3 changed files with 1,008 additions and 1,537 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "orbit-setup-script",
"dependencies": {
"@arbitrum/nitro-contracts": "^1.2.1",
"@arbitrum/orbit-sdk": "^0.11.1",
"@alt-research/orbit-sdk-avail": "^0.9.8",
"@arbitrum/orbit-sdk": "^0.21.1",
"@arbitrum/token-bridge-contracts": "^1.2.1",
"viem": "^1.20.0"
},
Expand Down
27 changes: 14 additions & 13 deletions scripts/createTokenBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ import { defineChain, createPublicClient, http, Address } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import {
createRollupPrepareTransactionReceipt,
createRollupFetchTransactionHash,
createTokenBridgeEnoughCustomFeeTokenAllowance,
createTokenBridgePrepareCustomFeeTokenApprovalTransactionRequest,
createTokenBridgePrepareTransactionRequest,
createTokenBridgePrepareTransactionReceipt,
} from '@arbitrum/orbit-sdk'
import {
createRollupFetchTransactionHash,
createTokenBridgePrepareSetWethGatewayTransactionRequest,
createTokenBridgePrepareSetWethGatewayTransactionReceipt,
} from '@alt-research/orbit-sdk-avail'
} from '@arbitrum/orbit-sdk'
import { sanitizePrivateKey } from '@arbitrum/orbit-sdk/utils'

import { L3Config } from './l3ConfigType'
Expand Down Expand Up @@ -109,7 +107,8 @@ export const createNewTokenBridge = async (
baseChainRpc: string,
baseChainDeployerKey: string,
childChainRpc: string,
rollupAddress: string
rollupAddress: string,
deployedAtBlockNumber: bigint
) => {
const l1Provider = new JsonRpcProvider(baseChainRpc)
const l1NetworkInfo = await l1Provider.getNetwork()
Expand Down Expand Up @@ -275,6 +274,7 @@ export const createNewTokenBridge = async (
const createRollupTxHash = await createRollupFetchTransactionHash({
rollup: rollupAddress as Address,
publicClient: parentChainPublicClient,
fromBlock: deployedAtBlockNumber,
})

const coreContracts = createRollupPrepareTransactionReceipt(
Expand Down Expand Up @@ -348,11 +348,19 @@ export const createERC20Bridge = async (
) => {
console.log('Creating token bridge for rollup', rollupAddress)

// Read the JSON configuration
const configRaw = fs.readFileSync(
'./config/orbitSetupScriptConfig.json',
'utf-8'
)
const config: L3Config = JSON.parse(configRaw)

const { l1Network, l2Network } = await createNewTokenBridge(
baseChainRpc,
baseChainDeployerKey,
childChainRpc,
rollupAddress
rollupAddress,
BigInt(config.deployedAtBlockNumber)
)
const NETWORK_FILE = 'network.json'
fs.writeFileSync(
Expand All @@ -361,13 +369,6 @@ export const createERC20Bridge = async (
)
console.log(NETWORK_FILE + ' updated')

// Read the JSON configuration
const configRaw = fs.readFileSync(
'./config/orbitSetupScriptConfig.json',
'utf-8'
)
const config: L3Config = JSON.parse(configRaw)

const outputInfo = {
chainInfo: {
minL2BaseFee: config.minL2BaseFee,
Expand Down
Loading

0 comments on commit 5ea3027

Please sign in to comment.