
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Web3Manager Class
The Web3Manager class provides a convenient interface for interacting with an Ethereum blockchain. Here's a guide on how to use its methods:
Class Instantiation
To use the `Web3Manager`` class, you need to instantiate it by providing the Ethereum node provider URL and the private key of the Ethereum account you want to manage.
const Web3Manager = require('woo-web3')
// Replace 'your-ethereum-node-url' and 'your-private-key' with actual values
const web3Manager = new Web3Manager('your-ethereum-node-url', 'your-private-key');
getTransaction(txHash: string): Promise<TransactionResponse | null>
This method retrieves details of a specific Ethereum transaction using its hash.
Usage:
const transactionDetails = await web3Manager.getTransaction('transaction-hash');
console.log(transactionDetails);
getBlock(blockHashOrBlockTag: ethers.BlockTag): Promise<ethers.Block | null>
Retrieve details of a specific Ethereum block using its hash or tag.
Usage:
const blockDetails = await web3Manager.getBlock('block-hash-or-tag');
console.log(blockDetails);
getBalance(address: string): Promise<string>
Get the balance of an Ethereum account in ether.
Usage:
const balance = await web3Manager.getBalance('ethereum-address');
console.log(balance);
transferBalance(amount: string, destinationAddress: string): Promise<TransactionResponse>
Transfer a specified amount of Ether to a destination address.
Usage:
const transactionResponse = await web3Manager.transferBalance('0.1', 'recipient-address');
console.log(transactionResponse);
isLegacyChain(): Promise<boolean>
Check if the Ethereum chain is using the legacy gas fee system.
Usage:
const isLegacy = await web3Manager.isLegacyChain();
console.log(isLegacy);
execute(options: ExecuteFunctionOptions): Promise<unknown>
Execute a function on a smart contract.
Params:
ExecuteFunctionOptions {
contractAddress: string
contractAbi: Array<any>
method: string
value?: string
params?: Array<any>
overrides?: {
gasLimit?: BigNumberish
gasPrice?: BigNumberish
maxPriorityFeePerGas?: BigNumberish
maxFeePerGas?: BigNumberish
}
}
Usage:
const executeResult = await web3Manager.execute({
contractAddress: 'contract-address',
contractAbi: [...], // ABI of the contract
method: 'contract-function-name',
value: '0', // Optional
params: [param1, param2], // Optional
overrides: { gasLimit: 50000 } // Optional
});
console.log(executeResult);
async function executeContractFunction() {
try {
// Instantiate Web3Manager
const web3Manager = new Web3Manager('your-ethereum-node-url', 'your-private-key');
// Execution options
const executeOptions: ExecuteFunctionOptions = {
contractAddress: '0x',
contractAbi: [...],
method: 'balanceOf',
params: [...],
};
// Execute the contract function
const result = await web3Manager.execute(executeOptions);
// Print the result of the execution
console.log('Contract executed successfully. Result:', result);
} catch (error) {
// Handle errors in contract execution
console.error('Error executing the contract:', error);
}
}
// Call the function
executeContractFunction();
Replace placeholder values like 'your-ethereum-node-url', 'your-private-key', 'transaction-hash', 'block-hash-or-tag', 'ethereum-address', 'recipient-address', 'contract-address', and other relevant values with actual data.
FAQs
Unknown package
The npm package woo-web3 receives a total of 0 weekly downloads. As such, woo-web3 popularity was classified as not popular.
We found that woo-web3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.