Skip to content

Commit

Permalink
chore: update connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Jun 17, 2023
1 parent a2a6819 commit cb1f506
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 165 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@
"viem": "1.0.1"
},
"patchedDependencies": {
"@coinbase/wallet-sdk@3.6.6": "patches/@coinbase__wallet-sdk@3.6.6.patch",
"@walletconnect/ethereum-provider@2.7.2": "patches/@walletconnect__ethereum-provider@2.7.2.patch",
"@web3modal/standalone@2.4.1": "patches/@web3modal__standalone@2.4.1.patch",
"vitepress@1.0.0-beta.1": "patches/vitepress@1.0.0-beta.1.patch"
"@coinbase/wallet-sdk@3.7.1": "patches/@coinbase__wallet-sdk@3.7.1.patch",
"vitepress@1.0.0-beta.1": "patches/vitepress@1.0.0-beta.1.patch",
"@walletconnect/ethereum-provider@2.8.1": "patches/@walletconnect__ethereum-provider@2.8.1.patch"
},
"peerDependencyRules": {
"ignoreMissing": [
Expand Down
6 changes: 3 additions & 3 deletions packages/connectors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
}
},
"dependencies": {
"@coinbase/wallet-sdk": "^3.6.6",
"@walletconnect/ethereum-provider": "^2.7.2",
"@web3modal/standalone": "^2.4.1"
"@coinbase/wallet-sdk": "^3.7.1",
"@walletconnect/ethereum-provider": "^2.8.1",
"@walletconnect/modal": "^2.4.6"
},
"devDependencies": {
"@wagmi/core": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions packages/connectors/src/walletConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export function walletConnect(parameters: WalletConnectParameters) {
]),
),
showQrModal: parameters.showQrModal ?? true,
...(parameters.metadata ? { metadata: parameters.metadata } : {}),
...(parameters.qrModalOptions
? { qrModalOptions: parameters.qrModalOptions }
: {}),
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/actions/reconnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ export type ReconnectReturnType = Pretty<Connection>[]

export type ReconnectError = Error

let isReconnecting = false

/** https://wagmi.sh/core/actions/reconnect */
export async function reconnect(
config: Config,
{ connectors: connectors_ }: ReconnectParameters = {},
): Promise<ReconnectReturnType> {
// If already reconnecting, do nothing
if (config.state.status === 'reconnecting') return []
if (isReconnecting) return []
isReconnecting = true

config.setState((x) => ({
...x,
Expand Down Expand Up @@ -59,6 +62,7 @@ export async function reconnect(
const connections = []
for (const connector of sorted) {
const isAuthorized = await connector.isAuthorized()
console.log(connector.name, isAuthorized)
if (!isAuthorized) continue

const data = await connector.connect()
Expand Down Expand Up @@ -95,6 +99,7 @@ export async function reconnect(
}))
else config.setState((x) => ({ ...x, status: 'connected' }))

isReconnecting = false
return connections
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/dist/index.d.ts b/dist/index.d.ts
index 91e621bca4d12589af0a4b37fb24f397cf9b682f..ad335d4fcd46d6a71e5acdaef1457a01bcd5a13e 100644
index 3874c88ec4a69f91057154bc7c5247e52d45fb6a..ad335d4fcd46d6a71e5acdaef1457a01bcd5a13e 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -3,26 +3,3 @@ import { CoinbaseWalletProvider } from "./provider/CoinbaseWalletProvider";
Expand All @@ -13,7 +13,7 @@ index 91e621bca4d12589af0a4b37fb24f397cf9b682f..ad335d4fcd46d6a71e5acdaef1457a01
- /**
- * For CoinbaseWalletSDK, window.ethereum is `CoinbaseWalletProvider`
- */
- ethereum?: unknown;
- ethereum?: any;
- coinbaseWalletExtension?: CoinbaseWalletProvider;
- /**
- * @deprecated Legacy API
Expand All @@ -30,15 +30,14 @@ index 91e621bca4d12589af0a4b37fb24f397cf9b682f..ad335d4fcd46d6a71e5acdaef1457a01
- }
-}
diff --git a/package.json b/package.json
index a32df713765097bde5c670c7bc261b589282cdff..f7c3d98f762342c71b327816d8b05f20ab55dc7d 100644
index 686f4e2e9d2a0a11df39bb85e472cc45777bacca..057fa691c8549159fc08e1cef9e84f601fe62ee9 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
"fix:prettier": "prettier . --write",
"release": "./scripts/release.sh"
},
-
@@ -19,6 +19,7 @@
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
+ "sideEffects": false,
"dependencies": {
"@metamask/safe-event-emitter": "2.0.0",
"@solana/web3.js": "^1.70.1",
"repository": "https://github.com/coinbase/coinbase-wallet-sdk.git",
"author": "Coinbase, Inc.",
"license": "Apache-2.0",
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,4 @@ index dff27436a8d55cc06f7cc02a90702b5e30fb53ed..0346be18dc213db9b5ebe722d1bfeb1c
-export default Provider;
+export { EthereumProvider };
+export default EthereumProvider;
//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
diff --git a/package.json b/package.json
index b47e5c340f8e3ac58e6c0fafa2fe5aaf18d42f96..63d12f78d4dbf7563e898aad1a62a0831b0ce528 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"default": "./dist/index.cjs.js"
}
},
+ "sideEffects": false,
"files": [
"dist"
],
//# sourceMappingURL=index.d.ts.map
12 changes: 0 additions & 12 deletions patches/@web3modal__standalone@2.4.1.patch

This file was deleted.

6 changes: 0 additions & 6 deletions playgrounds/vite-react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
useAccount,
useBalance,
useBlockNumber,
useChainId,
useConnect,
useConnections,
useDisconnect,
Expand Down Expand Up @@ -113,12 +112,10 @@ function Connections() {

function Balance() {
const { address } = useAccount()
const chainId = useChainId()

const { data: default_ } = useBalance({ address, watch: true })
const { data: account_ } = useBalance({
address,
chainId,
watch: true,
})
const { data: optimism_ } = useBalance({
Expand All @@ -139,11 +136,8 @@ function Balance() {
}

function BlockNumber() {
const chainId = useChainId()

const { data: default_ } = useBlockNumber({ watch: true })
const { data: account_ } = useBlockNumber({
chainId,
watch: true,
})
const { data: optimism_ } = useBlockNumber({
Expand Down
20 changes: 10 additions & 10 deletions playgrounds/vite-react/src/wagmi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { custom, fallback, http } from 'viem'
import { http } from 'viem'
import { mainnet, optimism, sepolia } from 'viem/chains'
import 'viem/window'
import { createConfig, createStorage } from 'wagmi'
Expand All @@ -24,15 +24,15 @@ export const config = createConfig({
],
storage: createStorage({ storage: localStorage, key: 'vite-react' }),
transports: {
[mainnet.id]: fallback([
custom(window.ethereum!),
http(
'https://eth-mainnet.g.alchemy.com/v2/StF61Ht3J9nXAojZX-b21LVt9l0qDL38',
),
]),
// [mainnet.id]: http(
// 'https://eth-mainnet.g.alchemy.com/v2/StF61Ht3J9nXAojZX-b21LVt9l0qDL38',
// ),
// [mainnet.id]: fallback([
// custom(window.ethereum!),
// http(
// 'https://eth-mainnet.g.alchemy.com/v2/StF61Ht3J9nXAojZX-b21LVt9l0qDL38',
// ),
// ]),
[mainnet.id]: http(
'https://eth-mainnet.g.alchemy.com/v2/StF61Ht3J9nXAojZX-b21LVt9l0qDL38',
),
[sepolia.id]: http(
'https://eth-sepolia.g.alchemy.com/v2/roJyEHxkj7XWg1T9wmYnxvktDodQrFAS',
),
Expand Down
Loading

0 comments on commit cb1f506

Please sign in to comment.