Skip to content

cryptopunkstar/cryptopunkstar-eth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple Web3 Project is a JavaScript library that provides a simple interface for interacting with the Ethereum blockchain using Web3.js.

Features

  • Fetch the latest block number on the Ethereum blockchain.
  • Get the balance of an Ethereum address.
  • Call methods of Ethereum smart contracts.

Installation

You can install Simple Web3 Project via npm:

npm install cryptopunkstar

Usage

const SimpleWeb3Project = require('cryptopunkstar-eth');

// Create an instance with your preferred Ethereum node endpoint const web3Project = new SimpleWeb3Project('https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID');

// Get the latest block number web3Project.getBlockNumber() .then(blockNumber => { console.log('Latest block number:', blockNumber); }) .catch(error => { console.error('Error:', error); });

// Get the balance of an Ethereum address const address = '0x1234..........................333'; // Replace with the desired address web3Project.getBalance(address) .then(balance => { console.log('Balance:', balance, 'ETH'); }) .catch(error => { console.error('Error:', error); });

// Call a method of a smart contract const contractAddress = '0x1234..........................333'; // Replace with the contract address const abi = []; // Replace with the contract ABI const methodName = 'methodName'; // Replace with the method name const methodParams = []; // Replace with method parameters web3Project.callContractMethod(contractAddress, abi, methodName, methodParams) .then(result => { console.log('Result:', result); }) .catch(error => { console.error('Error:', error); });

Replace 'https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID' with your actual Infura project ID.

Replace '0x1234..........................333', [], and 'methodName' with the actual contract address, ABI, method name, and method parameters respectively.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Web3.js - https://github.com/ethereum/web3.js/ javascript

youtube contact

https://www.youtube.com/@Cryptopunkstar

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published