I am intended to interact with Rootstock blockchain
from a vue.js DApp to track wallet balance and send RBTC.
I want to establish a Metamask connection
and use ethers.js web3 provider
to interact with the Rootstock network.
I created a Pinia…
I am trying to get MetaMask to popup to approve a dapp to use my erc20 tokens like:
const provider = new ethers.providers.JsonRpcProvider(url); // url === bsc testnet rpc
const erco20Contract = new ethers.Contract(
erco20ContractAddress,
…
I wanted to add hardhat to a project that uses ES modules. Hardhat complains that I can't use require in the hardhat.config.js file, so I renamed it to import, but it still won't compile with the following error:
require() of ES modules is not…
I am using Hardhat hackathon boilerplate and calling my smart contract's (address 1c0, addresses shortened for clarity) function MyContract#addProduct from the UI via ethers.js.
The problem: I see bunch of weird function calls before and after I…
I'm trying to consume a function from a smart contract using ethers.js. The function retrieve the info of a user logged before (with the help of other function). This is the function snippet.
function getUser(address _userAddress)
public
…
I'm using Ethers.js to allow users to connect their Metamask wallets to my app. Here's the code that I have:
import { ethers } from "ethers"
async function connect() {
const provider = new ethers.providers.Web3Provider(window.ethereum, "any")
…
I'm writing unit tests in Hardhat using Hardhat's mainnet fork, however it seems that the results from one test are affecting future tests and causing my assertions to fail. I'm forking using Alchemy and from block #14189520.
For example:
it("Test…
I am trying to make a simple js bot that checks every block for eth(or the main token of the chain) and sends it to another wallet.
I have a working bot:
const { ethers } = require('ethers')
const provider = new…
I'm calling getAmountsOut() from the UniswapV2Router02 contract using ethers.js, where I'm checking the amount of ETH I can get for 50000 DAI.
Using the below code, the output amount tells me I can currently get exactly 15 ETH. For testing purposes…
How can I set the gasPrice in a contract interaction using ethers.js? I'm trying to override the gasPrice in the code below:
let txPromise = contract.populateTransaction.runAdventureVRF(0, false, { gasPrice: 800000…
I have this issue on a simple react app. I am trying to connect to metamask using a "Connect" button, but when i click that button the console shows an error saying "Error: Invariant failed: No found."
As you can see, I…
I noticed that my little vanilla JS script to get people to connect to my "dapp" works fine on desktop with metamask, but doesn't work with metamask mobile app.
It gives me an error as if the "Provider" was not set.
const provider = new…
Problem: I want to test that a method is only callable by another contract.
Example:
// B.sol
contract B {
A _a;
uint256 i;
constructor(A a) {
_a = a;
i = 0;
}
function doSomething() external {
require(address(_a) ==…
This is a rough summary since these things exist in different views.
I have a react native app that uses wallet connect.
this allows me to connect to a meta mask wallet on my phone and creates a connector instance.
import {
useWalletConnect,
…
I'm starting to learn Solidity and how to interact with smart contracts within a Dapp, and I would like to know how can I log/handle errors from the contract in my Dapp.
For example, in the Dapp I have a button, when you click it, it runs a function…