Metamask: Why am I getting an Internal JSON-RPC error for calling one state variable from my contract but not on another very similar variable?

Metamask: International JSON-RPC for specific welsh

As Polish Ethers.js, who works to expose the Fuji Testnet avalanche with the Svelte, you, Verbathe, helps problems with the adverb of the complaint. In this state, we will get in this, why you can get Json-RPC input at the promotion of expiration of the only state of your action, but not the second very scoring.

Ponimians JSON-RPC and Ethers.js

Before you submit to hell, let’s go fast -the base base:

* JSON-RPC : Standard Barbacco protocol in the blockchain network. This provides free and efficient data transfer.

* ETHERS.JS : Popular JavaScript library for reciprocity with Ethereum with Web3 or Truffle.

Problem: International JSON-RPC

If you summarize the expiration of your contract to Metamask Khothelek, you should get intra-RPC if the expiry of the validity is unsuitable. For some listeners, however, this may get to access the same part of the frequent part in one and the same test.

Here is a primer that this may manifest itself:

In addition, you have the action of the “user” that defines two expirations: “Polish name” and “Electronic Mona”. Do you want to release these expirations from your thin adjacent, use eéters.Js in metamask:

`Javascript

{Ets} import;

Const Contractaddress = '0x ...';

Const Contontabi = [...]; // your contratt with the wash of abi

// Create a connection with an action to Testnet

Async function ConnectoContract () {

Constant Provider = New Ethers.Providers.Web3Provider (Window.ethereum);

Return to wait for provider.connect (Contractaddress);

}

// call the first part -Ten in conflict

Getuserinfo function () {)

Const Connection = Await Connectotocontract ();

ask {

Const User = AWAIT Connection.Getaccounts () [0];

Console.log (user.username); // This is to work normally

} Catch (Error) {

IF (Exanmitmpor Ethers.error) {if (scoop.

To throw the shoulder blade; // Intracible JSon-RPC

}

}

}

// Call in the right state from the counterattack

GetProfileInfo () {)

Const Connection = Await Connectotocontract ();

ask {

Const User = AWAIT Connection.Getaccounts () [0];

Console.log (user.Email); // This is also necessary to work normally

} Catch (Error) {

IF (Exanmitmpor Ethers.error) {if (scoop.

Throw the scoop; // Intracible JSon-RPC

}

}

}

As you can see, the Getuserinfo () ‘function has successfully caught the widespread condition. When using GetProfileInfo () Available intra-RPC:

`Javascript

// this is not normal to work

GetProfileInfo () {)

Const Connection = Await Connectotocontract ();

ask {

Const User = AWAIT Connection.Getaccounts () [0];

Console.log (user.Email); // Intracible JSon-RPC

} Catch (Error) {

IF (Exanmitmpor Ethers.error) {if (scoop.

To throw the shoulder blade; // Intracible JSon-RPC

}

}

}

Why am I shooting?

Metamask: Why am I getting an Internal JSON-RPC error for calling one state variable from my contract but not on another very similar variable?

This problem concludes that the ETS.JS is accessible to the essential states on the basis of a contract. When you call a part -is asked to reach values, he used Contractabi and sucking is a valuable feature in the post.

However, there is an approach to a similar part that is in other counterattacks in one and the same testing method “GetacCunts ()” Eat empty massively for each new connection. It is associated with the fact that wearing is not full of the establishment of what is committed.

You can use persistent excitement to solve this problem:

  • This is associated with a new embrace and the mood of the climb of the work when it is connected.

2

ETHEREUM SENDING BITCOIN CORE

Leave a Comment

Your email address will not be published. Required fields are marked *