Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@wagmi/core
Advanced tools
@wagmi/core is a library for building web3 applications with ease. It provides a set of hooks and utilities for managing Ethereum-based interactions, such as connecting to wallets, fetching blockchain data, and executing transactions.
Connect to Wallet
This feature allows you to connect to a user's Ethereum wallet using various connectors like MetaMask. The code sample demonstrates how to use the `connect` function to establish a connection.
const { connect } = require('@wagmi/core');
async function connectWallet() {
const { data, error } = await connect({ connector: new InjectedConnector() });
if (error) console.error(error);
else console.log('Connected:', data);
}
Fetch Blockchain Data
This feature allows you to fetch data from the blockchain, such as account balances. The code sample shows how to use the `useAccount` and `useBalance` hooks to retrieve and log the balance of the connected account.
const { useAccount, useBalance } = require('@wagmi/core');
function fetchBalance() {
const { data: accountData } = useAccount();
const { data: balanceData } = useBalance({ addressOrName: accountData?.address });
console.log('Balance:', balanceData);
}
Execute Transactions
This feature allows you to execute transactions on the Ethereum blockchain. The code sample demonstrates how to use the `useSendTransaction` hook to send 1 ETH to a specified address.
const { useSendTransaction } = require('@wagmi/core');
function sendTransaction() {
const { sendTransaction } = useSendTransaction();
sendTransaction({
request: {
to: '0xRecipientAddress',
value: '1000000000000000000', // 1 ETH in wei
},
}).then((result) => console.log('Transaction sent:', result));
}
Ethers.js is a library for interacting with the Ethereum blockchain and its ecosystem. It provides utilities for connecting to Ethereum nodes, managing wallets, and interacting with smart contracts. Compared to @wagmi/core, ethers.js is more low-level and requires more manual setup for common tasks.
Web3.js is a collection of libraries that allow you to interact with a local or remote Ethereum node using HTTP, IPC, or WebSocket. It provides functionalities for sending transactions, interacting with smart contracts, and more. Web3.js is one of the oldest and most widely used libraries for Ethereum development, but it can be more cumbersome to use compared to @wagmi/core.
VanillaJS library for Ethereum
pnpm add @wagmi/core viem
For documentation and guides, visit wagmi.sh.
FAQs
VanillaJS library for Ethereum
The npm package @wagmi/core receives a total of 110,165 weekly downloads. As such, @wagmi/core popularity was classified as popular.
We found that @wagmi/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.