Socket
Socket
Sign inDemoInstall

@eth-optimism/contracts-ts

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eth-optimism/contracts-ts

TypeScript interface for Contracts Bedrock


Version published
Weekly downloads
1.1K
decreased by-28.83%
Maintainers
2
Weekly downloads
 
Created
Source

Contracts TS

codecov

ABI and Address constants + generated code from @eth-optimism/contracts-bedrock/ for use in TypeScript.

Much of this package is generated. See CODE_GEN.md for instructions on how to generate.

@eth-optimism/contracts-ts

The main entrypoint exports constants related to contracts bedrock as const. As const allows it to be used in TypeScript with stronger typing than importing JSON.

  • Exports contract abis.
  • Exports contract addresses
import {
  l2OutputOracleProxyABI,
  l2OutputOracleAddresses,
} from '@eth-optimism/contracts-ts'

console.log(l2OutputOracleAddresses[10], abi)

Addresses are also exported as an object for convenience.

import { addresses } from '@eth-optimism/contracts-ts'

console.log(addresses.l2OutputOracle[10])
@eth-optimism/contracts-ts/react
import { useAddressManagerAddress } from '@eth-optimism/contracts-ts/react'

const component = () => {
  const { data, error, loading } = useAddressManagerAddress()
  if (loading) {
    return <div>Loading</div>
  }
  if (err) {
    return <div>Error</div>
  }
  return <div>{data}</div>
}
@eth-optimism/contracts-ts/actions
import { readSystemConfig } from '@eth-optimism/contracts-ts/actions'
console.log(await readSystemConfig())
See Also

FAQs

Package last updated on 20 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc