All Questions
Tagged with javascript metamask
110 questions
0
votes
0
answers
57
views
Why does the BitKepp (BitGet) wallet display isMetaMask:true in its properties?
I tried it in different browsers with and without MetaMask installed.
0
votes
1
answer
22
views
In which language should i write my deployment code Javascript or Solidity
Which language should I learn to write the deployment code for a smart contract: JavaScript or Solidity (using Foundry)? What should I learn according to today's trends?
0
votes
1
answer
100
views
Converting Eth price correctly in JS
i have this snippet i fixed the hex and suggested in the comments. Console error is here https://ibb.co/LShTFxX Metamask is still throwing large number
console.log('the conversion factor is', ...
0
votes
1
answer
98
views
web3.js code works on chrome + metamask but dosent work on metamask mobile
i have a few codes that works fine on chrome desktop but dosent work with metamask mobile
im using web3.js 1.2.7
here is code for connecting to wallet :
import Web3 from 'web3';
var web3 = new Web3(...
0
votes
1
answer
17
views
in cloud window.ehtereumundefined,in local window.ehtereum is object
I am developing a dapp now, deploy the dapp in local PC, it can connect with browser extension, window.ehtereum is Object, but deploy it in aws cloud, it cann't connect with browser extension, window....
0
votes
1
answer
125
views
Signature verification using web3js
I am using web3 library to sign a transaction and then verify it from the smart contract. The signature is not verifying.
This is the frontend code
const DomainSeparator = ethers.keccak256(
...
0
votes
1
answer
78
views
Rejecting the transaction doesn't catch the error in try-catch block
I am working on a Dapp porject ,Where I have to catch the metamask error.
Here is my code:
import React, {
createContext,
useContext,
useEffect,
useRef,
useState,
} from "react";
...
3
votes
1
answer
559
views
Viem wallet client method does not exist / is not available
I am trying to interact with a smart contract from a front-end web app using viem.
I am successfully creating a Wallet Client with my wallet address, but when I call some of its methods, I get the ...
1
vote
2
answers
275
views
Why i get evm revert error when calling the method from dapp front end (web3js & metamask)??? but my contract works fine on remix and bscscan
I've created a smartcontract & deployed on bsc testnet. For the past 8 weeks, i have been upgrading and testing the contract on remix and website and they always works fine. I can mint on remix ...
1
vote
0
answers
25
views
"not logged in" when metamask gets locked by password
I have a pretty standard code used by logging in via MetaMask, something similar to this:
const connectWallet = async () => {
const provider = new ethers.providers.Web3Provider(window.ethereum)
...
0
votes
1
answer
1k
views
unpredictable gas limit error doesn't go away after setting gasLimit manually
I have this contract which is written in solidity and one of the functions (getMyActivity()) returns an array of structs and im trying to call it from my frontend which is written in ReactJS but i get ...
0
votes
1
answer
76
views
Logging user on web3.js is calling a function before web3 is assigned
I have a little weird problem. I'm creating the front-end of a blockchain app with react and web3. Everything is perfect and it connects fine, but when I reload the page and call the getNfts() ...
0
votes
2
answers
7k
views
We were not able to estimate gas. There might be an error in the contract and this transaction may fail
I cannot add a candidate as it shows there is an error in the contract, but the code does not show any error.
**// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;
contract Election{...
2
votes
2
answers
2k
views
How to detect the specific wallet provider used by the user in a web3 dapp when multiple wallet providers are installed?
I want to detect which wallet provider has been used to connect to a specific dApp.
right now what I'm doing is
const ethereum = window.ethereum;
const web3 = window.web3;
if (ethereum && ...
0
votes
2
answers
387
views
Send ETH from contract to wallet shows as a deduction from wallet rather than addition to it and balance is unchanged
I have the following smart contract function that is supposed to be called from a web app, using ethers and Metamask, running on Hardhat localhost blockchain. Its purpose is to send the specified ...
0
votes
0
answers
92
views
Receiving Invalid Address on Web3
I am having issues launching my web3 connected to Solidity (on Remix) and MetaMask. The error that popped out was that I have an invalid address and they were referencing the function called ...
0
votes
1
answer
695
views
Metamask SDK window is not defined on nextjs
I`m trying to integrate Metamsk SDK to my Dapp, but when implementing the steps on the basic tutorial of their documentation I get the Reference error related to window, here is my code:
import { ...
1
vote
0
answers
24
views
Chrome refuses to open and claims my dapp website is malicious
I just deployed a simple dapp on which users can connect their wallet and deploy their own ERC20 token. However, when I click the link of my website, Chrome doesn't open it and I get a red page ...
0
votes
0
answers
77
views
Can anyone tell me where the problem is? I am trying to make a sort of auto-transaction feature in html using js, but I get this error?
async function getAccount() { accounts = await ethereum.request({ method: 'eth_requestAccounts' }) ;
if (window.ethereum) {
let messageHash = "...
0
votes
0
answers
32
views
Can I allow a user to sign a contract, and then based on that contract to make a transaction without approval?
For example, let's say we have a sender and a receiver. A is the sender and B is the receiver.
For exampple I have a website. Using js, user A signs a contract, and by hitting the donate button on ...
1
vote
0
answers
41
views
Metamask Connect Button Not working when adding "Deposit" function
I'm following a tutorial for a basic app that utilizes Metamask, this is my code in index.js:
import { ethers } from "./ethers-5.6.esm.min.js"
import { abi, contractAddress } from "./...
0
votes
1
answer
25
views
Have user pay for withdrawing funds from owner only function
I have some complicated user case and have decided to go with a hybrid offchain and onchain method for my rewards system. The issue is that we want rewards to only be available to certain users that ...
1
vote
0
answers
134
views
Metamask The method "signTypedData_v4" does not exist / is not available
I am trying to use metamask with signedTypeDatav3 or v4. Their docs say the latest protocol standards are supported but when I do the following I get an error "does not exist"
const ...
0
votes
1
answer
685
views
MetaMask - RPC Error: execution reverted, Simple NFT Miniting Dapp
I'm building a simple NFT minting Dapp for fundraising. I first deployed contracts on Polygon testnet and then on Ethereum testnet goerli. While integrating, my front-end with my smart contracts using ...
0
votes
1
answer
69
views
ReferenceError: web3 is not defined
<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script>
<script>
window.onload = function(){
if(typeof web3==&...
0
votes
1
answer
724
views
How to transfer custom ERC-20 token with Ethereum in one transaction
I would like to send custom ERC-20 token with Ethereum in one transaction.
I know how to send both of them alone...
How to do it it one transaction?
SEND CUSTOM ERC-20 TOKEN (There USDC):
<script ...
1
vote
0
answers
638
views
Authorization using Metamask - Signing and validating - can you find any weaknesses in this approach?
I would like to develop a webapp (frontend: ReactJs, backend: Spring Boot) in which users can interact without logging in in the traditional sense of the word (username + password) but instead using ...
0
votes
1
answer
422
views
How to get transaction link into etherumscan to my website using etherumscan API
please help me with my problem :
I am creating a website with blockchain. Now I need to get my transaction results into etherscan.io to my website with a link for this transaction and all these by ...
0
votes
1
answer
164
views
Testing a SmatContract on Ropsten - The transaction is "Success" but I didn't get token in my wallet
I'm trying to take my first steps in the blockchain, and sometimes I stuck with some very weird issue (for me), this is one of them.
I've deployed a very simple SmallContract that inherit from @...
0
votes
1
answer
3k
views
Ether.js BigNumber overflow when I use a contract with wei
I made a page where you can enter an amount of token and it gets swapped to another token.
It works until I use a number above 999. My smartcontract gets wei, so I have to transform the normal number ...
1
vote
1
answer
166
views
How is the Gas Price field in Metamask populated?
I have an evm compatible blockchain with a price limit set to 10000.
However when I go to submit a transaction to a validator, Metamask populates the gas price at 0:
How can I ensure transactions are ...
0
votes
2
answers
760
views
What exactly does the 'ethereum' keyword in 'window.ethereum' referring to?
Is it referring to the ethereum blockchain?
Sorry if this seems too basic of a question.
I'm new and I can't seem to find an answer anywhere.
0
votes
1
answer
63
views
Need help understanding "the template code provided by Metamask for how we can detect to see if the user has Metamask installed"?
I'm going through an online Solidity Tutorial, and it shows me this:
"Here's some template code provided by Metamask for how we can detect
to see if the user has Metamask installed, and if not ...
1
vote
0
answers
222
views
How to integrate with anyswap router
I need to create my own token router form integrating with anyswap router https://anyswap.exchange/bridge#/router
I am creating an instance of a contract based on it's ABI and then I am calling this ...
0
votes
1
answer
384
views
Can I check the transfer status?
I am trying to set up a structure that will receive payment with the sendTransaction method. But there is a small problem. The sendTransaction method works fine, but has the user completed the ...
1
vote
1
answer
1k
views
How to fix "MetaMask no longer injects web3" & "Cannot read properties of undefined (reading 'toWei')" errors when using Drizzle for building a Dapp?
I'm trying to build a decentralized app for a lottery smart contract, deployed on a local ganache ethereum network, but in this case I'm using Drizzle tool from Truffle Suite.
This is the smart ...
2
votes
1
answer
2k
views
Fake an address from my browser / metamask
I want to use a website as an ethereum address that I don't control, so I can get calldata for some specific transaction(s) from that address.
In my chrome JS console, I can do window.ethereum....
1
vote
2
answers
1k
views
Interacting with metamask from Javascript. Etherum is not defined
Im trying to implement a very basic Metamask integration to show balances.
Im working with GoDaddy's website builder which allows you to inject arbitrary html into the of the page.
This is the code ...
2
votes
0
answers
412
views
MetaMask RPC API 'This message cannot be decrypted' using eth_decrypt
I am attempting to encrypt an image, post to IPFS, get the image back from IPFS and decrypt. I have successfully achieved this with string data with no issues. When I try to do the same with image ...
0
votes
0
answers
554
views
How can I let an user login to their Metamask wallet and return their public address on mobile?
At the moment my website allows users to link their Metamask wallet by simply using the window.ethereum object that is attached to the window, assuming the metamask chrome extension is installed. Once ...
1
vote
1
answer
3k
views
I am getting the following error : RPC Error: Invalid parameters: must provide an Ethereum address
I am getting the following error: RPC Error: Invalid parameters: must provide an Ethereum address.
It is a simple code to send transactions using a metamask chrome extension.
<script>
let ...
2
votes
1
answer
2k
views
Encryption using public key from eth_getEncryptionPublicKey metamask function
I'm trying to encrypt data/files before uploading them to IPFS and I want to do this using metamask provided public and private keys. For this, I have tried using eth_getEncryptionPublicKey but this ...
2
votes
2
answers
3k
views
disconnect wallet from metamask using ethers js
I've created a website on WIX (a web editor) and thought that I could add my code to engage with metamask and the smart contract that I've created, turnes out that wix doesn't support web3 so I ...
0
votes
2
answers
2k
views
How to handle MetaMask disconnecting from dapp?
How do you detect when a MetaMask user disconnects their wallet from your dapp? I see there is a disconnect event, but this is a for disconnecting from RPC - I want to know when the user has ...
1
vote
0
answers
3k
views
How do I generate a metamask mobile deep link programmatically?
I found this site. https://metamask.github.io/metamask-deeplinks/#
Which returns a url like:
https://metamask.app.link/dapp/tipme.cash
However if I change the domain name programmatically it doesn’t ...
2
votes
1
answer
2k
views
wallet_addEthereumChain is not working in metamask android app
I am using wallet_addEthereumChain RPC function to add the custom network in metamask android app through our Dapp but it is showing an error wrong chainid. The chainid(80001) is correct and the code ...
0
votes
0
answers
110
views
Uncaught Error: invalid address when transferring token
When I try to transfer the token from 1 address to another, the error in the title pops up.
Here is my relevant JS code:
$("#targetAddr").val() is the address of the target address (in ...
2
votes
2
answers
6k
views
Integrating MetaMask function into Wix Website
I am currently working in part on an NFT project, and I am the web designer for it. Most things are coming together nicely, yet I am now experiencing issues with MetaMask integration. I'm not a ...
0
votes
1
answer
352
views
Why is my Smart Contract function not being recognized by web3?
I am trying to develop a new Dapp. I have written the smart contracts and they are working well. I now need to use web3 to interact with the smart contracts, for now using ropsten or rinkeby.
I get ...
0
votes
0
answers
7k
views
MetaMask - Internal JSON-RPC error
i was developing a full stack nft marketplace, where i can mint nfts but when i try to buy it gives me this error :MetaMask - Internal JSON-RPC error
code: 3, message: "execution reverted: Please ...