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

@wagmi/core

Package Overview
Dependencies
Maintainers
2
Versions
512
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wagmi/core

JavaScript library for Ethereum

  • 0.2.0-next.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
111K
decreased by-54.82%
Maintainers
2
Weekly downloads
 
Created

What is @wagmi/core?

@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.

What are @wagmi/core's main functionalities?

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));
}

Other packages similar to @wagmi/core

FAQs

Package last updated on 27 Mar 2022

Did you know?

Socket

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.

Install

Related posts

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