Skip to content

Commit

Permalink
Merge pull request #392 from blocto/release/0131
Browse files Browse the repository at this point in the history
Release: Merge to publish new version to npm
  • Loading branch information
q20274982 authored Jan 31, 2024
2 parents d7cdcd5 + 7262e29 commit 56c377f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
14 changes: 14 additions & 0 deletions adapters/wagmi-connector/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @blocto/wagmi-connector

## 2.0.1

### Patch Changes

- 7f68b54: fix(wagmi): obtain chainId through request
- 073daf0: Show not in config error message when attempt to switch dapp unsupport chain

## 2.0.1-beta.0

### Patch Changes

- 7f68b54: fix(wagmi): obtain chainId through request
- 073daf0: Show not in config error message when attempt to switch dapp unsupport chain

## 2.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion adapters/wagmi-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@blocto/wagmi-connector",
"description": "Blocto wallet connector extend from wagmi Connector",
"author": "Calvin Chang",
"version": "2.0.0",
"version": "2.0.1",
"type": "module",
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
Expand Down
10 changes: 6 additions & 4 deletions adapters/wagmi-connector/src/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ export function blocto({ appId }: BloctoParameters = {}) {
},
async getChainId() {
const provider = await this.getProvider();
const chainId =
provider.chainId ??
(await provider?.request({ method: 'eth_chainId' }));
const chainId = await provider?.request({ method: 'eth_chainId' });
return normalizeChainId(chainId);
},
async getProvider({ chainId } = {}) {
Expand Down Expand Up @@ -124,7 +122,11 @@ export function blocto({ appId }: BloctoParameters = {}) {
);
const isBloctoSupportChain = evmSupportMap[`${chainId}`];

if (!chain || !isBloctoSupportChain) {
if (!chain) {
throw new SwitchChainError(new Error(`Chain not in config: ${id}`));
}

if (!isBloctoSupportChain) {
throw new SwitchChainError(
new Error(`Blocto unsupported chain: ${id}`)
);
Expand Down

0 comments on commit 56c377f

Please sign in to comment.