Skip to content
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: added isMainnetOnly to isBase and isEthereum utilities #1167 #1221

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cool-walls-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@coinbase/onchainkit': patch
---

- **feat**: added `isMainnetOnly` to `isBase` and `isEthereum` utilities. By @zizzamia #1167 #1221
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

### Patch Changes

- **feat**: added support for `EIP-5792` (https://eips.ethereum.org/EIPS/eip-5792) in `OnchainKitProvider`. By @0xAlec #1181
- **fix**: adjusted hover styling for the `Fund` and `Disconnect` wallet components in mobile view. By @cpcramer #1211
- **feat** added `walletCapabilities` for atomic batching (`useWriteContracts` vs `useWriteContract`) in `Transaction` component. By @0xAlec #1214
- **feat**: added support for `EIP-5792` (https://eips.ethereum.org/EIPS/eip-5792) in `OnchainKitProvider`. By@0xAlec #1181
- **fix**: adjusted hover styling for the `Fund` and `Disconnect` wallet components in mobile view. By@cpcramer #1211
- **feat** added `walletCapabilities` for atomic batching (`useWriteContracts` vs `useWriteContract`) in`Transaction` component. By @0xAlec #1214

## 0.31.3

Expand Down
33 changes: 33 additions & 0 deletions site/docs/pages/config/is-ethereum.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# `isEthereum`

The `isEthereum` utility is designed to verify if the chain id is a valid Ethereum Mainnet or Ethereum Sepolia chain id.

## Usage

:::code-group

```tsx [code]
import { isEthereum } from '@coinbase/onchainkit';

const chainId = 1;

if (isEthereum({ chainId })) {
console.log('The chainId is Ethereum Mainnet or Ethereum Sepolia.');
} else {
console.log('The chainId is not Ethereum.');
}
```

```ts [return value]
true;
```

:::

## Returns

`boolean` - Returns `true` if the chain id is Ethereum Mainnet or Ethereum Sepolia, otherwise `false`.

## Parameters

[`isEthereumOptions`](/config/types#isethereumoptions)
Loading