3.3.0 • Published 30 days ago

@eth-optimism/sdk v3.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
30 days ago

@eth-optimism/sdk

codecov

The @eth-optimism/sdk package provides a set of tools for interacting with Optimism.

Warning!!!

@eth-optimism/sdk has been superseded by op-viem. For most developers we suggest you migrate to viem which has native built in op-stack support built in. It also has additional benefits.

The OP Labs team has no plans to add new features @eth-optimism/sdk and it is in maintenance mode

If you are already using the sdk you are safe as it will continue to be maintained.

  • an intuitive API that learned from this package and is now revamped
  • great treeshaking with a 10x+ improvement to bundlesize
  • Better performance
  • Updated to use the latest op stack contracts. At times it will save you gas compared to using viem.

If viem does not have what you need please let us know by opening an issue in the viem repo or here. Letting us know helps us advocate to upstream more functionality to viem. Viem is missing the following functionality:

  • ERC20 support

If viem doesn't have what you need, the extensions for viem, op-viem extensions, likely have it too.

Installation

npm install @eth-optimism/sdk

Docs

You can find auto-generated API documentation over at sdk.optimism.io.

Contributing

Most of the core functionality is in the CrossChainMessenger file.

Using the SDK

CrossChainMessenger

The CrossChainMessenger class simplifies the process of moving assets and data between Ethereum and Optimism. You can use this class to, for example, initiate a withdrawal of ERC20 tokens from Optimism back to Ethereum, accurately track when the withdrawal is ready to be finalized on Ethereum, and execute the finalization transaction after the challenge period has elapsed. The CrossChainMessenger can handle deposits and withdrawals of ETH and any ERC20-compatible token. Detailed API descriptions can be found at sdk.optimism.io. The CrossChainMessenger automatically connects to all relevant contracts so complex configuration is not necessary.

L2Provider and related utilities

The Optimism SDK includes various utilities for handling Optimism's transaction fee model. For instance, estimateTotalGasCost will estimate the total cost (in wei) to send at transaction on Optimism including both the L2 execution cost and the L1 data cost. You can also use the asL2Provider function to wrap an ethers Provider object into an L2Provider which will have all of these helper functions attached.

Other utilities

The SDK contains other useful helper functions and constants. For a complete list, refer to the auto-generated SDK documentation

3.3.0

30 days ago

3.2.3

1 month ago

3.2.2

2 months ago

3.2.1

2 months ago

3.2.0

3 months ago

3.1.8

4 months ago

3.1.7

4 months ago

3.1.3

7 months ago

3.1.2

8 months ago

3.1.1

9 months ago

3.1.0

10 months ago

3.1.6

5 months ago

3.1.5

6 months ago

3.1.4

7 months ago

2.0.2

1 year ago

2.0.1

1 year ago

3.0.0

11 months ago

2.1.0

11 months ago

2.0.0

1 year ago

1.10.4

1 year ago

1.10.3

1 year ago

1.10.2

1 year ago

1.9.1

1 year ago

1.10.1

1 year ago

1.10.0

1 year ago

1.8.0

1 year ago

1.6.4

2 years ago

1.6.3

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.6.11

1 year ago

1.6.10

1 year ago

1.7.0

1 year ago

1.6.9

2 years ago

1.6.8

2 years ago

1.6.7

2 years ago

1.6.6

2 years ago

1.6.5

2 years ago

1.2.0

2 years ago

1.6.0

2 years ago

1.4.0

2 years ago

1.2.1

2 years ago

1.1.9

2 years ago

1.5.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.0.0-2022310341

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.3

2 years ago

0.0.5

2 years ago

0.2.2

2 years ago

0.0.4

2 years ago

0.2.5

2 years ago

0.0.7

2 years ago

0.2.4

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago