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

viem

Package Overview
Dependencies
Maintainers
1
Versions
2212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viem

TypeScript Interface for Ethereum

  • 0.0.1-alpha.29
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
622K
decreased by-0.52%
Maintainers
1
Weekly downloads
 
Created

What is viem?

The 'viem' npm package is a versatile library designed for interacting with Ethereum blockchain networks. It provides a range of functionalities including connecting to Ethereum nodes, sending transactions, interacting with smart contracts, and more.

What are viem's main functionalities?

Connecting to Ethereum Nodes

This feature allows you to create a client that connects to an Ethereum node using a specified URL. In this example, the client connects to the Infura mainnet node.

const { createClient } = require('viem');
const client = createClient({
  url: 'https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID'
});

Sending Transactions

This feature allows you to send transactions on the Ethereum network. The example demonstrates sending 1 ETH from one address to another.

const { sendTransaction } = require('viem');
const tx = await sendTransaction(client, {
  from: '0xYourAddress',
  to: '0xRecipientAddress',
  value: '1000000000000000000' // 1 ETH in wei
});

Interacting with Smart Contracts

This feature allows you to interact with smart contracts by calling their functions. The example shows how to call a function of a smart contract using its ABI and function name.

const { callContractFunction } = require('viem');
const result = await callContractFunction(client, {
  contractAddress: '0xContractAddress',
  abi: [
    // ABI of the contract
  ],
  functionName: 'functionName',
  args: [/* function arguments */]
});

Other packages similar to viem

Keywords

FAQs

Package last updated on 21 Feb 2023

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