OffchainLabs / orbit-setup-script

39 stars 61 forks source link

Missing package in orbit setup script #69

Open Johnaverse opened 3 months ago

Johnaverse commented 3 months ago

Fail to run PRIVATE_KEY="0xYourPrivateKey" L2_RPC_URL="https://sepolia-rollup.arbitrum.io/rpc" L3_RPC_URL="http://localhost:8449" yarn run setup.

yarn install has been applied before running the command.

Error logs:

resumeState file found, will restart from where it failed last time.
Running tokenBridgeDeployment or erc20TokenBridge script to deploy token bridge contracts on parent chain and your Orbit chain 🌉🌉🌉🌉🌉
Creating token bridge for rollup 0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e
Error occurred: ContractFunctionExecutionError: HTTP request failed.

URL: https://sepolia-rollup.arbitrum.io/rpc
Request body: {"method":"eth_call","params":[{"data":"0xe78cea92","to":"0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e"},"latest"]}

Raw Call Arguments:
  to:    0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e
  data:  0xe78cea92

Contract Call:
  address:   0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e
  function:  bridge()

Docs: https://viem.sh/docs/contract/readContract.html
Details: fetch is not defined
Version: viem@1.21.3
    at getContractError (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/utils/errors/getContractError.ts:72:10)
    at readContract (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/actions/public/readContract.ts:114:27)
    at async isCustomFeeTokenChain (/home/johnathan/Desktop/orbit-setup-script/node_modules/@arbitrum/orbit-sdk/dist/utils/isCustomFeeTokenChain.js:6:20)
    ... 3 lines matching cause stack trace ...
    at async main (/home/johnathan/Desktop/orbit-setup-script/scripts/setup.ts:160:7) {
  details: 'fetch is not defined',
  docsPath: '/docs/contract/readContract',
  metaMessages: [
    'URL: https://sepolia-rollup.arbitrum.io/rpc',
    'Request body: {"method":"eth_call","params":[{"data":"0xe78cea92","to":"0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e"},"latest"]}',
    ' ',
    'Raw Call Arguments:',
    '  to:    0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e\n  data:  0xe78cea92',
    ' ',
    'Contract Call:',
    '  address:   0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e\n' +
      '  function:  bridge()'
  ],
  shortMessage: 'HTTP request failed.',
  version: 'viem@1.21.3',
  cause: CallExecutionError: HTTP request failed.

  URL: https://sepolia-rollup.arbitrum.io/rpc
  Request body: {"method":"eth_call","params":[{"data":"0xe78cea92","to":"0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e"},"latest"]}

  Raw Call Arguments:
    to:    0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e
    data:  0xe78cea92

  Details: fetch is not defined
  Version: viem@1.21.3
      at getCallError (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/utils/errors/getCallError.ts:42:10)
      at call (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/actions/public/call.ts:204:23)
      at async readContract (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/actions/public/readContract.ts:95:22)
      at async isCustomFeeTokenChain (/home/johnathan/Desktop/orbit-setup-script/node_modules/@arbitrum/orbit-sdk/dist/utils/isCustomFeeTokenChain.js:6:20)
      at async createTokenBridgePrepareTransactionRequest (/home/johnathan/Desktop/orbit-setup-script/node_modules/@arbitrum/orbit-sdk/dist/createTokenBridgePrepareTransactionRequest.js:18:32)
      at async createNewTokenBridge (/home/johnathan/Desktop/orbit-setup-script/scripts/createTokenBridge.ts:167:21)
      at async createERC20Bridge (/home/johnathan/Desktop/orbit-setup-script/scripts/createTokenBridge.ts:333:36)
      at async main (/home/johnathan/Desktop/orbit-setup-script/scripts/setup.ts:160:7) {
    details: 'fetch is not defined',
    docsPath: undefined,
    metaMessages: [
      'URL: https://sepolia-rollup.arbitrum.io/rpc',
      'Request body: {"method":"eth_call","params":[{"data":"0xe78cea92","to":"0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e"},"latest"]}',
      ' ',
      'Raw Call Arguments:',
      '  to:    0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e\n' +
        '  data:  0xe78cea92'
    ],
    shortMessage: 'HTTP request failed.',
    version: 'viem@1.21.3',
    cause: HttpRequestError: HTTP request failed.

    URL: https://sepolia-rollup.arbitrum.io/rpc
    Request body: {"method":"eth_call","params":[{"data":"0xe78cea92","to":"0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e"},"latest"]}

    Details: fetch is not defined
    Version: viem@1.21.3
        at Object.http (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/utils/rpc.ts:142:11)
        at async fn (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/clients/transports/http.ts:107:18)
        at async request (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/clients/transports/http.ts:109:39)
        at async delay.count.count (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/utils/buildRequest.ts:129:18)
        at async attemptRetry (/home/johnathan/Desktop/orbit-setup-script/node_modules/viem/utils/promise/withRetry.ts:37:22) {
      details: 'fetch is not defined',
      docsPath: undefined,
      metaMessages: [Array],
      shortMessage: 'HTTP request failed.',
      version: 'viem@1.21.3',
      body: [Object],
      headers: undefined,
      status: undefined,
      url: 'https://sepolia-rollup.arbitrum.io/rpc'
    }
  },
  abi: [
    {
      name: 'bridge',
      type: 'function',
      stateMutability: 'view',
      inputs: [],
      outputs: [Array]
    }
  ],
  args: undefined,
  contractAddress: '0x6460Ce41bF21aB9EBA3F1a484d99aa59FE987E9e',
  formattedArgs: undefined,
  functionName: 'bridge',
  sender: undefined
}
Seems something went wrong during this process, but don't worry, we have recorded the deployed and initialized contracts into ./config/resumeState.json, next time you rerun the script, it will restart from where it failed 
Done in 8.10s.

Look like package for fetch is missing in package.json.

RISHABHAGRAWALZRA commented 1 month ago

Change the node version to v20.11.1, it works for me

hovanhoa commented 1 month ago

I think u should change the default RPC to infura RPC for Arbitrum. It makes this process more smooth.