Skip to content

Commit

Permalink
feat: added isMainnetOnly to isBase and isEthereum utilities coinbase…
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia committed Sep 8, 2024
1 parent 5b98428 commit ef232c3
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 79 deletions.
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

0 comments on commit ef232c3

Please sign in to comment.