Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web3.Js #56

Closed
Tracked by #13
manuelbarbas opened this issue Dec 21, 2023 · 1 comment
Closed
Tracked by #13

Web3.Js #56

manuelbarbas opened this issue Dec 21, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@manuelbarbas
Copy link
Collaborator

manuelbarbas commented Dec 21, 2023

Web3.js

Set of Javascript libraries enabling interaction with a local or remote Ethereum node through HTTP, IPC, or WebSocket protocols.

Some of the features are:

  • Complete implementation of Ethereum's JSON-RPC client API over HTTP and IPC
  • Create accounts, process and sign transactions.
  • Get block and state information from Ethereum nodes.

For more information check the Web3.js documentation.

Implementation Example

Package install

npm install web3

Function Call Contract

import Web3 from "web3";
import {contract_abi,contract_adress} from "./contract";

var web3 = new Web3("https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix");
const pk = "wallet pk";
const accountAddress = "wallet address";

const contract = new web3.eth.Contract(contract_abi, contract_adress);

const functionData = contract.methods._mintTest(accountAddress).encodeABI();

async function callMintFunction() {
  web3.eth.accounts.signTransaction( 
    {
      from: accountAddress,
      to: contract_adress,
      gas: 500000,
      gasPrice: 100000,
      data: functionData,
    }, 
    pk)
    .then((signedTransaction) => {
      return web3.eth.sendSignedTransaction(signedTransaction.rawTransaction || "");
    })
    .then((receipt) => {
      console.log("Transaction receipt:", receipt);
    })
    .catch((error) => {
      console.error("Error sending transaction:", error);
    });
}
callMintFunction();
@manuelbarbas
Copy link
Collaborator Author

What is: Library
Language: Javascript, Typescript
Target: Web

@manuelbarbas manuelbarbas added the documentation Improvements or additions to documentation label Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant