-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from base-org/refactor-chain-config-api
Refactor chain config api
- Loading branch information
Showing
84 changed files
with
787 additions
and
1,135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
"op-viem": patch | ||
--- | ||
|
||
Actions now receive contract addresses instead of L2 config objects for simplicty and Viem upstream compatibility. op-viem/chains now eexports addresses objects that be spread into actions to pass the required address. | ||
|
||
Previously | ||
|
||
```ts | ||
import { publicL1Actions } from 'op-viem' | ||
import { base } from 'op-viem/chains' | ||
import { createPublicClient } from 'viem' | ||
|
||
const publicClient = createPublicClient({ | ||
account, | ||
chain: mainnet, | ||
transport: http(), | ||
}).extend(publicL1Actions) | ||
|
||
await getOutputForL2Block(publicClient, { | ||
blockNumber: 2725977n, | ||
l2Chain: base, | ||
}) | ||
``` | ||
|
||
Now | ||
|
||
```ts | ||
import { publicL1Actions } from 'op-viem' | ||
import { baseAddresses } from 'op-viem/chains' | ||
import { createPublicClient } from 'viem' | ||
|
||
const publicClient = createPublicClient({ | ||
account, | ||
chain: mainnet, | ||
transport: http(), | ||
}).extend(publicL1Actions) | ||
|
||
await getOutputForL2Block(publicClient, { | ||
blockNumber: 2725977n, | ||
l2OutputOracle: baseAddresses.l2OutputOracle, | ||
}) | ||
|
||
// more simply | ||
await getOutputForL2Block(publicClient, { | ||
blockNumber: 2725977n, | ||
...baseAddresses, | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.