Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into feat/add-ledger-switch-chains
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom authored Mar 15, 2023
2 parents 21fc757 + 033486b commit 9d1033e
Show file tree
Hide file tree
Showing 19 changed files with 204 additions and 55 deletions.
5 changes: 0 additions & 5 deletions .changeset/forty-bugs-arrive.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/proud-trains-hang.md

This file was deleted.

7 changes: 7 additions & 0 deletions packages/chains/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @wagmi/chains

## 0.2.12

### Patch Changes

- c6b2b3a: Added Scroll Testnet Chain
- f9c1f95: Added Klaytn, Dogechain, DFK, and Cronos Chains.

## 0.2.11

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/chains/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@wagmi/chains",
"description": "A collection of chains for wagmi",
"license": "MIT",
"version": "0.2.11",
"version": "0.2.12",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/chains/src/boba.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const boba = {
network: 'boba',
nativeCurrency: {
decimals: 18,
name: 'BOBA',
symbol: 'ETH',
name: 'Boba',
symbol: 'BOBA',
},
rpcUrls: {
default: { http: ['https://mainnet.boba.network'] },
Expand Down
26 changes: 26 additions & 0 deletions packages/chains/src/cronos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Chain } from './types'

export const cronos = {
id: 25,
name: 'Cronos',
network: 'cronos',
nativeCurrency: {
decimals: 18,
name: 'Cronos',
symbol: 'CRO',
},
rpcUrls: {
default: { http: ['https://node.croswap.com/rpc'] },
public: { http: ['https://node.croswap.com/rpc'] },
},
blockExplorers: {
etherscan: { name: 'CronosScan', url: 'https://cronoscan.com' },
default: { name: 'CronosScan', url: 'https://cronoscan.com' },
},
contracts: {
multicall3: {
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
blockCreated: 1963112,
},
},
} as const satisfies Chain
30 changes: 30 additions & 0 deletions packages/chains/src/dfk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Chain } from './types'

export const dfk = {
id: 53_935,
name: 'DFK Chain',
network: 'dfk',
nativeCurrency: {
decimals: 18,
name: 'Jewel',
symbol: 'JEWEL',
},
rpcUrls: {
default: {
http: ['https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc'],
},
public: {
http: ['https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc'],
},
},
blockExplorers: {
etherscan: {
name: 'DFKSubnetScan',
url: 'https://subnets.avax.network/defi-kingdoms',
},
default: {
name: 'DFKSubnetScan',
url: 'https://subnets.avax.network/defi-kingdoms',
},
},
} as const satisfies Chain
26 changes: 26 additions & 0 deletions packages/chains/src/dogechain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Chain } from './types'

export const dogechain = {
id: 2_000,
name: 'Dogechain',
network: 'dogechain',
nativeCurrency: {
decimals: 18,
name: 'Dogechain',
symbol: 'DC',
},
rpcUrls: {
default: { http: ['https://rpc.dogechain.dog'] },
public: { http: ['https://rpc.dogechain.dog'] },
},
blockExplorers: {
etherscan: {
name: 'DogeChainExplorer',
url: 'https://explorer.dogechain.dog',
},
default: {
name: 'DogeChainExplorer',
url: 'https://explorer.dogechain.dog',
},
},
} as const satisfies Chain
4 changes: 2 additions & 2 deletions packages/chains/src/goerli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const goerli = {
address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
},
ensUniversalResolver: {
address: '0x687c30Cc44bFA39A1449e86E172BF002E7b3f0b0',
blockCreated: 7725078,
address: '0xA292E2E58d4ddEb29C33c63173d0E8B7a2A4c62e',
blockCreated: 8610406,
},
multicall3: {
address: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
4 changes: 4 additions & 0 deletions packages/chains/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export { bscTestnet } from './bscTestnet'
export { canto } from './canto'
export { celo } from './celo'
export { celoAlfajores } from './celoAlfajores'
export { cronos } from './cronos'
export { crossbell } from './crossbell'
export { dfk } from './dfk'
export { dogechain } from './dogechain'
export { evmos } from './evmos'
export { evmosTestnet } from './evmosTestnet'
export { fantom } from './fantom'
Expand All @@ -33,6 +36,7 @@ export { gnosis } from './gnosis'
export { gnosisChiado } from './gnosisChiado'
export { hardhat } from './hardhat'
export { harmonyOne } from './harmonyOne'
export { klaytn } from './klaytn'
export { localhost } from './localhost'
export { mainnet } from './mainnet'
export { metis } from './metis'
Expand Down
20 changes: 20 additions & 0 deletions packages/chains/src/klaytn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Chain } from './types'

export const klaytn = {
id: 8_217,
name: 'Klaytn',
network: 'klaytn',
nativeCurrency: {
decimals: 18,
name: 'Klaytn',
symbol: 'KLAY',
},
rpcUrls: {
default: { http: ['https://cypress.fautor.app/archive'] },
public: { http: ['https://cypress.fautor.app/archive'] },
},
blockExplorers: {
etherscan: { name: 'KlaytnScope', url: 'https://scope.klaytn.com' },
default: { name: 'KlaytnScope', url: 'https://scope.klaytn.com' },
},
} as const satisfies Chain
4 changes: 2 additions & 2 deletions packages/chains/src/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const mainnet = {
address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
},
ensUniversalResolver: {
address: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376',
blockCreated: 16172161,
address: '0xE4Acdd618deED4e6d2f03b9bf62dc6118FC9A4da',
blockCreated: 16773775,
},
multicall3: {
address: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down
10 changes: 10 additions & 0 deletions packages/connectors/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @wagmi/connectors

## 0.3.3

### Patch Changes

- f24ce0c: Updated @walletconnect/ethereum-provider to 2.4.8
- e3a3fee: Added "uniswap wallet" to the regex that determines wallets allowed to switch chains in the WalletConnect legacy connector
- 641af48: Added name mapping for Bifrost Wallet
- 4d2c90a: Added name mapping for Phantom
- 3d276d0: Added Status as the name of the injected connector for the Status App

## 0.3.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@wagmi/connectors",
"description": "A collection of connectors for wagmi",
"license": "MIT",
"version": "0.3.2",
"version": "0.3.3",
"scripts": {
"build": "tsup",
"dev": "DEV=true tsup"
Expand All @@ -23,7 +23,7 @@
"dependencies": {
"@coinbase/wallet-sdk": "^3.5.4",
"@ledgerhq/connect-kit-loader": "^1.0.1",
"@walletconnect/ethereum-provider": "^2.4.7",
"@walletconnect/ethereum-provider": "^2.4.8",
"@walletconnect/legacy-provider": "^2.0.0",
"@safe-global/safe-apps-provider": "^0.15.2",
"@safe-global/safe-apps-sdk": "^7.9.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/connectors/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type WatchAssetParams = {
type InjectedProviderFlags = {
isApexWallet?: true
isAvalanche?: true
isBifrost?: true
isBitKeep?: true
isBitski?: true
isBraveWallet?: true
Expand All @@ -63,6 +64,7 @@ type InjectedProviderFlags = {
isPhantom?: true
isPortal?: true
isRainbow?: true
isStatus?: true
isTally?: true
isTokenPocket?: true
isTokenary?: true
Expand Down
2 changes: 2 additions & 0 deletions packages/connectors/src/utils/getInjectedName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe.each([
ethereum: { isAvalanche: true, isMetaMask: true },
expected: 'Core Wallet',
},
{ ethereum: { isBifrost: true }, expected: 'Bifrost Wallet' },
{ ethereum: { isBitKeep: true }, expected: 'BitKeep' },
{ ethereum: { isBitski: true }, expected: 'Bitski' },
{ ethereum: { isBraveWallet: true }, expected: 'Brave Wallet' },
Expand All @@ -41,6 +42,7 @@ describe.each([
{ ethereum: { isPhantom: true, isMetaMask: true }, expected: 'Phantom' },
{ ethereum: { isPortal: true }, expected: 'Ripio Portal' },
{ ethereum: { isRainbow: true }, expected: 'Rainbow' },
{ ethereum: { isStatus: true }, expected: 'Status' },
{ ethereum: { isTally: true }, expected: 'Tally' },
{
ethereum: { isTokenPocket: true, isMetaMask: true },
Expand Down
2 changes: 2 additions & 0 deletions packages/connectors/src/utils/getInjectedName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export function getInjectedName(ethereum?: Ethereum) {
const getName = (provider: Ethereum) => {
if (provider.isApexWallet) return 'Apex Wallet'
if (provider.isAvalanche) return 'Core Wallet'
if (provider.isBifrost) return 'Bifrost Wallet'
if (provider.isBitKeep) return 'BitKeep'
if (provider.isBitski) return 'Bitski'
if (provider.isBraveWallet) return 'Brave Wallet'
Expand All @@ -21,6 +22,7 @@ export function getInjectedName(ethereum?: Ethereum) {
if (provider.isPhantom) return 'Phantom'
if (provider.isPortal) return 'Ripio Portal'
if (provider.isRainbow) return 'Rainbow'
if (provider.isStatus) return 'Status'
if (provider.isTally) return 'Tally'
if (provider.isTokenPocket) return 'TokenPocket'
if (provider.isTokenary) return 'Tokenary'
Expand Down
3 changes: 2 additions & 1 deletion packages/connectors/src/walletConnectLegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import { Connector } from './base'
* - MetaMask (metamask.io)
* - Rainbow (rainbow.me)
* - Trust Wallet (trustwallet.com)
* - Uniswap Wallet (uniswap.org)
*/
const switchChainAllowedRegex =
/(imtoken|metamask|rainbow|trust wallet|ledger)/i
/(imtoken|metamask|rainbow|trust wallet|uniswap wallet|ledger)/i

type WalletConnectOptions = ConstructorParameters<
typeof WalletConnectProvider
Expand Down
Loading

0 comments on commit 9d1033e

Please sign in to comment.