-
-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: opstack (part one) #1469
Merged
Merged
feat: opstack (part one) #1469
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
4aad957
wip: opstack init
jxom b5a55c0
feat: total gas
jxom f131d27
feat: total gas
jxom 0fda304
feat: imports
jxom dbbcf8a
docs: migration guide
jxom ad5543b
feat: exports
jxom 7e398b6
docs: celo
jxom 3e3ce30
docs
jxom abd099b
feat: fees
jxom 97f53fb
feat: contract fee/gas estimation
jxom 0ce723a
feat: exports
jxom de02236
feat: exports
jxom 602c2ae
chore: docspath
jxom 20ca3ae
chore: update snaps
jxom 2835c52
docs: address
jxom 26436f8
docs: sidebar
jxom 6bb914b
tests: fix
jxom 7cdaabd
fix: exports
jxom 2101b71
docs: fix links
jxom d9d074a
docs: typos
jxom ce9d778
Update site/docs/op-stack/client.md
jxom 11ae67b
Update site/docs/op-stack/estimateContractL1Fee.md
jxom 23a50a3
Update site/docs/op-stack/estimateContractL1Gas.md
jxom 53ce3dc
Update site/docs/op-stack/estimateContractTotalFee.md
jxom 96f3ddd
Update site/docs/op-stack/estimateContractL1Gas.md
jxom e1fa906
Update site/docs/op-stack/estimateContractL1Fee.md
jxom 161b3c6
chore: export
jxom 0529ccb
chore: pr review
jxom 9701291
docs: updatE
jxom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
VITE_ANVIL_FORK_URL= | ||
VITE_ANVIL_BLOCK_TIME=1 | ||
VITE_ANVIL_BLOCK_NUMBER=16280770 | ||
VITE_NETWORK_TRANSPORT_MODE=http | ||
VITE_ANVIL_PORT=8545 | ||
VITE_BATCH_JSON_RPC=false | ||
VITE_BATCH_MULTICALL=false | ||
VITE_ANVIL_PORT=8545 | ||
VITE_NETWORK_TRANSPORT_MODE=http | ||
VITE_RPC_URL_OPTIMISM= |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,88 @@ | ||
--- | ||
head: | ||
- - meta | ||
- property: og:title | ||
content: Celo | ||
- - meta | ||
- name: description | ||
content: Integrating with Celo in Viem | ||
- - meta | ||
- property: og:description | ||
content: Integrating with Celo in Viem | ||
--- | ||
|
||
# Celo | ||
|
||
Viem provides first-class support for chains implemented on [Celo](https://celo.org/). | ||
|
||
## Chains | ||
|
||
The following Viem chains are implemented on Celo: | ||
|
||
```ts | ||
import { | ||
celo, // [!code hl] | ||
celoAlfajores, // [!code hl] | ||
celoCannoli, // [!code hl] | ||
} from 'viem/chains' | ||
``` | ||
|
||
### Configuration | ||
|
||
Viem exports Celo's chain [formatters](/docs/chains/formatters) & [serializers](/docs/chains/serializers) via `chainConfig`. This is useful if you need to define another chain which is implemented on Celo. | ||
|
||
```ts | ||
import { defineChain } from 'viem' | ||
import { chainConfig } from 'viem/celo' | ||
|
||
export const celoExample = defineChain({ | ||
...chainConfig, | ||
name: 'Celo Example', | ||
// ... | ||
}) | ||
``` | ||
|
||
## Utilities | ||
|
||
### `parseTransaction` | ||
|
||
Parses a serialized RLP-encoded transaction. Supports signed & unsigned CIP-42, CIP-64, EIP-1559, EIP-2930 and Legacy Transactions. | ||
|
||
Celo-flavored version of [Viem's `parseTransaction`](/docs/utilities/parseTransaction). | ||
|
||
#### Parameters | ||
|
||
- `serializedTransaction` (`Hex`): The serialized transaction. | ||
|
||
```ts | ||
import { parseTransaction } from 'viem/celo' | ||
|
||
const transaction = parseTransaction('0x7cf84682a4ec80847735940084773594008094765de816845861e75a25fca122bb6898b8b1282a808094f39fd6e51aad88f6f4ce6ab8827279cfffb92266880de0b6b3a764000080c0') | ||
``` | ||
|
||
### `serializeTransaction` | ||
|
||
Serializes a transaction object. Supports CIP-42, CIP-64, EIP-1559, EIP-2930, and Legacy transactions. | ||
|
||
Celo-flavored version of [Viem's `serializeTransaction`](/docs/utilities/serializeTransaction). | ||
|
||
#### Parameters | ||
|
||
- `transaction` (`TransactionSerializable`): The transaction object to serialize. | ||
- `signature` (`Signature`): Optional signature to include. | ||
|
||
```ts | ||
import { serializeTransaction } from 'viem/celo' | ||
|
||
const serialized = serializeTransaction({ | ||
chainId: 1, | ||
gas: 21001n, | ||
gatewayFee: parseGwei('3'), | ||
gatewayFeeRecipient: '0x1234512345123451234512345123451234512345', | ||
maxFeePerGas: parseGwei('20'), | ||
maxPriorityFeePerGas: parseGwei('2'), | ||
nonce: 69, | ||
to: '0x1234512345123451234512345123451234512345', | ||
value: parseEther('0.01'), | ||
}) | ||
``` |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,73 @@ | ||
# zkSync | ||
--- | ||
head: | ||
- - meta | ||
- property: og:title | ||
content: zkSync | ||
- - meta | ||
- name: description | ||
content: Integrating with zkSync in Viem | ||
- - meta | ||
- property: og:description | ||
content: Integrating with zkSync in Viem | ||
--- | ||
|
||
# zkSync | ||
|
||
Viem provides first-class support for chains implemented on [zkSync](https://zksync.io/). | ||
|
||
## Chains | ||
|
||
The following Viem chains are implemented on zkSync: | ||
|
||
```ts | ||
import { | ||
zkSync, // [!code hl] | ||
zkSyncTestnet, // [!code hl] | ||
} from 'viem/chains' | ||
``` | ||
|
||
### Configuration | ||
|
||
Viem exports zkSync's chain [formatters](/docs/chains/formatters) & [serializers](/docs/chains/serializers) via `chainConfig`. This is useful if you need to define another chain which is implemented on zkSync. | ||
|
||
```ts | ||
import { defineChain } from 'viem' | ||
import { chainConfig } from 'viem/zkSync' | ||
|
||
export const zkSyncExample = defineChain({ | ||
...chainConfig, | ||
name: 'zkSync Example', | ||
// ... | ||
}) | ||
``` | ||
|
||
## Utilities | ||
|
||
### `serializeTransaction` | ||
|
||
Serializes a transaction object. Supports EIP-712, EIP-1559, EIP-2930, and Legacy transactions. | ||
|
||
zkSync-flavored version of [Viem's `serializeTransaction`](/docs/utilities/serializeTransaction). | ||
|
||
#### Parameters | ||
|
||
- `transaction` (`TransactionSerializable`): The transaction object to serialize. | ||
- `signature` (`Signature`): Optional signature to include. | ||
|
||
```ts | ||
import { serializeTransaction } from 'viem/celo' | ||
|
||
const serialized = serializeTransaction({ | ||
chainId: 1, | ||
gas: 21001n, | ||
maxFeePerGas: parseGwei('20'), | ||
maxPriorityFeePerGas: parseGwei('2'), | ||
nonce: 69, | ||
paymaster: '0x4B5DF730c2e6b28E17013A1485E5d9BC41Efe021', | ||
paymasterInput: | ||
'0x8c5a344500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000', | ||
to: '0x1234512345123451234512345123451234512345', | ||
type: 'eip712', | ||
value: parseEther('0.01'), | ||
}) | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Chains | ||
|
||
The following Viem chains are implemented on the OP Stack: | ||
|
||
```ts | ||
import { | ||
base, // [!code hl] | ||
baseGoerli, // [!code hl] | ||
baseSepolia, // [!code hl] | ||
optimism, // [!code hl] | ||
optimismGoerli, // [!code hl] | ||
optimismSepolia, // [!code hl] | ||
zora, // [!code hl] | ||
zoraSepolia, // [!code hl] | ||
zoraTestnet, // [!code hl] | ||
} from 'viem/chains' | ||
``` | ||
|
||
## Configuration | ||
|
||
Viem exports OP Stack's chain [formatters](/docs/chains/formatters) & [serializers](/docs/chains/serializers) via `chainConfig`. This is useful if you need to define another chain which is implemented on the OP Stack. | ||
|
||
```ts | ||
import { defineChain } from 'viem' | ||
import { chainConfig } from 'viem/op-stack' | ||
|
||
export const opStackExample = defineChain({ | ||
...chainConfig, | ||
name: 'OP Stack Example', | ||
// ... | ||
}) | ||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could see this becoming unwieldy to keep up to date. I have an early project idea of making a simple node cli application that uses the superchain registry as source of truth and then can be composed with other tools to generate code and documentation based on all the supported chains. It could be used to generate the op stack specific chain objects for example too
If this sounds useful to you let me know so we can prioritize it