Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@web3modal/wagmi

Package Overview
Dependencies
Maintainers
10
Versions
264
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web3modal/wagmi - npm Package Compare versions

Comparing version 5.0.11-57abd61b5.0 to 5.0.11

77

dist/esm/src/client.js

@@ -1,11 +0,13 @@

import { connect, disconnect, getAccount, getBalance, getEnsName, prepareTransactionRequest, reconnect, signMessage, switchChain, estimateGas as wagmiEstimateGas, getEnsAddress as wagmiGetEnsAddress, getEnsAvatar as wagmiGetEnsAvatar, sendTransaction as wagmiSendTransaction, writeContract as wagmiWriteContract, waitForTransactionReceipt, watchAccount, watchConnectors } from '@wagmi/core';
import { EthereumProvider, OPTIONAL_METHODS } from '@walletconnect/ethereum-provider';
import { ConstantsUtil as CommonConstantsUtil, NetworkUtil } from '@web3modal/common';
import { connect, disconnect, signMessage, getBalance, getEnsAvatar as wagmiGetEnsAvatar, getEnsName, switchChain, watchAccount, watchConnectors, waitForTransactionReceipt, estimateGas as wagmiEstimateGas, writeContract as wagmiWriteContract, getAccount, getEnsAddress as wagmiGetEnsAddress, reconnect, getConnections, switchAccount } from '@wagmi/core';
import { mainnet } from 'viem/chains';
import { prepareTransactionRequest, sendTransaction as wagmiSendTransaction } from '@wagmi/core';
import { formatUnits, parseUnits } from 'viem';
import { Web3ModalScaffold } from '@web3modal/scaffold';
import { ConstantsUtil, HelpersUtil, PresetsUtil } from '@web3modal/scaffold-utils';
import { ConstantsUtil, PresetsUtil, HelpersUtil } from '@web3modal/scaffold-utils';
import { ConstantsUtil as CommonConstantsUtil } from '@web3modal/common';
import { getCaipDefaultChain, getEmailCaipNetworks, getWalletConnectCaipNetworks } from './utils/helpers.js';
import { W3mFrameConstants, W3mFrameHelpers, W3mFrameRpcConstants } from '@web3modal/wallet';
import { formatUnits, parseUnits } from 'viem';
import { mainnet } from 'viem/chains';
import { NetworkUtil } from '@web3modal/common';
import { normalize } from 'viem/ens';
import { getCaipDefaultChain, getEmailCaipNetworks, getWalletConnectCaipNetworks } from './utils/helpers.js';
export class Web3Modal extends Web3ModalScaffold {

@@ -54,22 +56,18 @@ constructor(options) {

}
let chainId = NetworkUtil.caipNetworkIdToNumber(this.getCaipNetwork()?.id);
if (this.getIsSiweEnabled() && typeof provider?.authenticate === 'function') {
const chainId = NetworkUtil.caipNetworkIdToNumber(this.getCaipNetwork()?.id);
const siweParams = await siweConfig?.getMessageParams?.();
if (siweConfig?.options?.enabled &&
typeof provider?.authenticate === 'function' &&
siweParams &&
Object.keys(siweParams || {}).length > 0) {
const { SIWEController, getDidChainId, getDidAddress } = await import('@web3modal/siwe');
if (!SIWEController.state._client) {
return;
}
const params = await SIWEController?.getMessageParams?.();
console.log({ params });
if (!params || !Object.keys(params || {}).length) {
return;
}
let reorderedChains = this.wagmiConfig.chains.map(c => c.id);
await connector.setRequestedChainsIds(reorderedChains);
await connector.setRequestedChainsIds(siweParams.chains);
let reorderedChains = siweParams.chains;
if (chainId) {
reorderedChains = [chainId, ...reorderedChains.filter(c => c !== chainId)];
reorderedChains = [chainId, ...siweParams.chains.filter(c => c !== chainId)];
}
const result = await provider.authenticate({
nonce: await SIWEController.getNonce(),
nonce: await siweConfig.getNonce(),
methods: [...OPTIONAL_METHODS],
...params,
...siweParams,
chains: reorderedChains

@@ -82,7 +80,6 @@ });

const address = getDidAddress(p.iss);
chainId = parseInt(cacaoChainId, 10);
if (address && cacaoChainId) {
SIWEController.setSession({
address,
chainId
chainId: parseInt(cacaoChainId, 10)
});

@@ -98,4 +95,3 @@ }

signature: s.s,
cacao: signedCacao,
clientId
cacao: signedCacao
});

@@ -109,4 +105,4 @@ }

}
this.wagmiConfig.state.current = '';
}
this.wagmiConfig.state.current = '';
}

@@ -149,7 +145,6 @@ await connect(this.wagmiConfig, { connector, chainId });

await disconnect(this.wagmiConfig);
this.setClientId(null);
if (siweConfig?.options?.signOutOnDisconnect) {
const { SIWEController } = await import('@web3modal/siwe');
if (SIWEController.state._client?.options?.signOutOnDisconnect) {
await SIWEController.signOut();
}
await SIWEController.signOut();
}

@@ -257,2 +252,20 @@ },

});
this.setEIP6963Enabled(w3mOptions.enableEIP6963 !== false);
this.subscribeShouldUpdateToAddress((newAddress) => {
if (newAddress) {
const connections = getConnections(this.wagmiConfig);
const connector = connections[0]?.connector;
if (connector) {
switchAccount(this.wagmiConfig, {
connector
}).then(response => this.syncAccount({
address: newAddress,
isConnected: true,
addresses: response.accounts,
connector,
chainId: response.chainId
}));
}
}
});
}

@@ -568,9 +581,9 @@ getState() {

}
const chainId = NetworkUtil.caipNetworkIdToNumber(this.getCaipNetwork()?.id);
this.setPreferredAccountType(type, this.chain);
this.syncAccount({
address: address,
chainId,
isConnected: true,
chainId: NetworkUtil.caipNetworkIdToNumber(this.getCaipNetwork()?.id),
connector
}).then(() => this.setPreferredAccountType(type));
});
});

@@ -577,0 +590,0 @@ }

@@ -0,3 +1,3 @@

import type { Chain } from '@wagmi/core/chains';
import type { Config } from '@wagmi/core';
import type { Chain } from '@wagmi/core/chains';
import type { LibraryOptions, PublicStateControllerState, Token } from '@web3modal/scaffold';

@@ -4,0 +4,0 @@ import { Web3ModalScaffold } from '@web3modal/scaffold';

@@ -14,5 +14,5 @@ import type { CreateConfigParameters } from '@wagmi/core';

};
export declare function authConnector(parameters: AuthParameters): import("@wagmi/core").CreateConnectorFn<import("packages/wallet/dist/types/index.js").W3mFrameProvider, {
provider?: import("packages/wallet/dist/types/index.js").W3mFrameProvider | undefined;
export declare function authConnector(parameters: AuthParameters): import("@wagmi/core").CreateConnectorFn<import("packages/wallet/index.js").W3mFrameProvider, {
provider?: import("packages/wallet/index.js").W3mFrameProvider | undefined;
}, Record<string, unknown>>;
export {};
{
"name": "@web3modal/wagmi",
"version": "5.0.11-57abd61b5.0",
"version": "5.0.11",
"type": "module",

@@ -49,10 +49,10 @@ "main": "./dist/esm/exports/index.js",

"@walletconnect/utils": "2.14.0",
"@web3modal/polyfills": "5.0.11-57abd61b5.0",
"@web3modal/wallet": "5.0.11-57abd61b5.0",
"@web3modal/scaffold": "5.0.11-57abd61b5.0",
"@web3modal/common": "5.0.11-57abd61b5.0",
"@web3modal/scaffold-react": "5.0.11-57abd61b5.0",
"@web3modal/scaffold-utils": "5.0.11-57abd61b5.0",
"@web3modal/scaffold-vue": "5.0.11-57abd61b5.0",
"@web3modal/siwe": "5.0.11-57abd61b5.0"
"@web3modal/polyfills": "5.0.11",
"@web3modal/wallet": "5.0.11",
"@web3modal/scaffold": "5.0.11",
"@web3modal/scaffold-react": "5.0.11",
"@web3modal/common": "5.0.11",
"@web3modal/scaffold-utils": "5.0.11",
"@web3modal/scaffold-vue": "5.0.11",
"@web3modal/siwe": "5.0.11"
},

@@ -59,0 +59,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc