@web3modal/wagmi
Advanced tools
Comparing version 4.1.12-ethers-status.0 to 4.1.12-sign-2.5.0
@@ -5,2 +5,3 @@ import { Web3Modal } from '../src/client.js'; | ||
export { emailConnector } from '../src/connectors/EmailConnector.js'; | ||
export { alphaWalletConnect } from '../src/connectors/alphaWalletConnect.js'; | ||
export function createWeb3Modal(options) { | ||
@@ -7,0 +8,0 @@ return new Web3Modal({ ...options, _sdkVersion: `html-wagmi-${ConstantsUtil.VERSION}` }); |
@@ -1,2 +0,2 @@ | ||
import { EthereumProvider } from '@walletconnect/ethereum-provider'; | ||
import { EthereumProvider, OPTIONAL_METHODS } from '@walletconnect/ethereum-provider'; | ||
import { connect, disconnect, signMessage, getBalance, getEnsAvatar, getEnsName, switchChain, watchAccount, watchConnectors, waitForTransactionReceipt, estimateGas as wagmiEstimateGas, getAccount } from '@wagmi/core'; | ||
@@ -51,2 +51,41 @@ import { mainnet } from 'viem/chains'; | ||
const chainId = NetworkUtil.caipNetworkIdToNumber(this.getCaipNetwork()?.id); | ||
if (siweConfig?.options?.enabled && typeof provider?.authenticate === 'function') { | ||
const { SIWEController, getDidChainId, getDidAddress } = await import('@web3modal/siwe'); | ||
const siweParams = await siweConfig.getMessageParams(); | ||
await connector.setRequestedChainsIds(siweParams.chains); | ||
const result = await provider.authenticate({ | ||
nonce: await siweConfig.getNonce(), | ||
methods: [...OPTIONAL_METHODS], | ||
...siweParams | ||
}); | ||
const signedCacao = result?.auths?.[0]; | ||
if (signedCacao) { | ||
const { p, s } = signedCacao; | ||
const cacaoChainId = getDidChainId(p.iss) || ''; | ||
const address = getDidAddress(p.iss); | ||
if (address && cacaoChainId) { | ||
SIWEController.setSession({ | ||
address, | ||
chainId: parseInt(cacaoChainId, 10) | ||
}); | ||
} | ||
try { | ||
const message = provider.signer.client.formatAuthMessage({ | ||
request: p, | ||
iss: p.iss | ||
}); | ||
await SIWEController.verifyMessage({ | ||
message, | ||
signature: s.s, | ||
cacao: signedCacao | ||
}); | ||
} | ||
catch (error) { | ||
console.error('Error verifying message', error); | ||
await provider.disconnect().catch(console.error); | ||
await SIWEController.signOut().catch(console.error); | ||
throw error; | ||
} | ||
} | ||
} | ||
await connect(this.wagmiConfig, { connector, chainId }); | ||
@@ -53,0 +92,0 @@ }, |
import '@web3modal/polyfills'; | ||
import { createConfig } from '@wagmi/core'; | ||
import { coinbaseWallet, walletConnect, injected } from '@wagmi/connectors'; | ||
import { coinbaseWallet, injected } from '@wagmi/connectors'; | ||
import { emailConnector } from '../connectors/EmailConnector.js'; | ||
import { alphaWalletConnect } from '../connectors/alphaWalletConnect.js'; | ||
import { getTransport } from './helpers.js'; | ||
@@ -14,3 +15,3 @@ export function defaultWagmiConfig({ projectId, chains, metadata, enableInjected, enableCoinbase, enableEmail, enableWalletConnect, enableEIP6963, ...wagmiConfig }) { | ||
if (enableWalletConnect !== false) { | ||
connectors.push(walletConnect({ projectId, metadata, showQrModal: false })); | ||
connectors.push(alphaWalletConnect({ projectId, metadata, showQrModal: false })); | ||
} | ||
@@ -17,0 +18,0 @@ if (enableInjected !== false) { |
import '@web3modal/polyfills'; | ||
import { createConfig } from 'wagmi'; | ||
import { coinbaseWallet, walletConnect, injected } from 'wagmi/connectors'; | ||
import { coinbaseWallet, injected } from 'wagmi/connectors'; | ||
import { emailConnector } from '../connectors/EmailConnector.js'; | ||
import { alphaWalletConnect } from '../connectors/alphaWalletConnect.js'; | ||
import { getTransport } from './helpers.js'; | ||
@@ -14,3 +15,3 @@ export function defaultWagmiConfig({ projectId, chains, metadata, enableInjected, enableCoinbase, enableEmail, enableWalletConnect, enableEIP6963, ...wagmiConfig }) { | ||
if (enableWalletConnect !== false) { | ||
connectors.push(walletConnect({ projectId, metadata, showQrModal: false })); | ||
connectors.push(alphaWalletConnect({ projectId, metadata, showQrModal: false })); | ||
} | ||
@@ -17,0 +18,0 @@ if (enableInjected !== false) { |
@@ -6,2 +6,3 @@ import type { Web3ModalOptions, CoreConfig } from '../src/client.js'; | ||
export { emailConnector } from '../src/connectors/EmailConnector.js'; | ||
export { alphaWalletConnect } from '../src/connectors/alphaWalletConnect.js'; | ||
export declare function createWeb3Modal(options: Web3ModalOptions<CoreConfig>): Web3Modal; |
{ | ||
"name": "@web3modal/wagmi", | ||
"version": "4.1.12-ethers-status.0", | ||
"version": "4.1.12-sign-2.5.0", | ||
"type": "module", | ||
@@ -54,12 +54,13 @@ "main": "./dist/esm/exports/index.js", | ||
"dependencies": { | ||
"@web3modal/polyfills": "4.1.12-ethers-status.0", | ||
"@web3modal/scaffold": "4.1.12-ethers-status.0", | ||
"@web3modal/scaffold-react": "4.1.12-ethers-status.0", | ||
"@web3modal/scaffold-utils": "4.1.12-ethers-status.0", | ||
"@web3modal/scaffold-vue": "4.1.12-ethers-status.0", | ||
"@web3modal/siwe": "4.1.12-ethers-status.0" | ||
"@walletconnect/ethereum-provider": "2.12.1", | ||
"@web3modal/polyfills": "4.1.12-sign-2.5.0", | ||
"@web3modal/scaffold": "4.1.12-sign-2.5.0", | ||
"@web3modal/scaffold-react": "4.1.12-sign-2.5.0", | ||
"@web3modal/scaffold-utils": "4.1.12-sign-2.5.0", | ||
"@web3modal/scaffold-vue": "4.1.12-sign-2.5.0", | ||
"@web3modal/siwe": "4.1.12-sign-2.5.0" | ||
}, | ||
"devDependencies": { | ||
"@wagmi/connectors": "4.1.14", | ||
"@wagmi/core": "2.6.5", | ||
"@wagmi/connectors": "4.1.25", | ||
"@wagmi/core": "2.6.16", | ||
"react": "18.2.0", | ||
@@ -71,3 +72,3 @@ "react-dom": "18.2.0", | ||
"peerDependencies": { | ||
"@wagmi/connectors": ">=4.0.0", | ||
"@wagmi/connectors": ">=4", | ||
"@wagmi/core": ">=2.0.0", | ||
@@ -74,0 +75,0 @@ "react": ">=17", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
95197
38
1195
13
+ Added@walletconnect/core@2.12.1(transitive)
+ Added@walletconnect/ethereum-provider@2.12.1(transitive)
+ Added@walletconnect/heartbeat@1.2.1(transitive)
+ Added@walletconnect/jsonrpc-provider@1.0.13(transitive)
+ Added@walletconnect/jsonrpc-types@1.0.3(transitive)
+ Added@walletconnect/sign-client@2.12.1(transitive)
+ Added@walletconnect/types@2.12.02.12.1(transitive)
+ Added@walletconnect/universal-provider@2.12.1(transitive)
+ Added@walletconnect/utils@2.12.02.12.1(transitive)
+ Added@web3modal/common@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/core@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/polyfills@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/scaffold@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/scaffold-react@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/scaffold-utils@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/scaffold-vue@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/siwe@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/ui@4.1.12-sign-2.5.0(transitive)
+ Added@web3modal/wallet@4.1.12-sign-2.5.0(transitive)
+ Addedisomorphic-unfetch@3.1.0(transitive)
+ Addeduint8arrays@3.1.1(transitive)
+ Addedunfetch@4.2.0(transitive)
- Removed@web3modal/common@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/core@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/polyfills@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/scaffold@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/scaffold-react@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/scaffold-utils@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/scaffold-vue@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/siwe@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/ui@4.1.12-ethers-status.0(transitive)
- Removed@web3modal/wallet@4.1.12-ethers-status.0(transitive)