web3.js
or ethers.js
).web3.js
or ethers.js
to interact with your deployed contracts. Alternatively, any other JSON-RPC client can be used if you are comfortable with lower-level interactions.storedValue
is a public uint256
. By making it public, Solidity automatically creates a getter function storedValue()
that returns the value.balances
is a public mapping from address
to uint256
. Likewise, balances(address)
becomes a getter function to read the balance for any given address.storedValue
and balances
using ethers.js
.
Ethers.js Example:
view
functions (storedValue()
and balances(address)
) to retrieve data without sending a transaction.storedValue
will fetch and display the current storedValue
.balances
will fetch and display the mapping value for that address.User
is stored in a private mapping. We expose a getUser
function that returns the data in a single call. You can fetch it from your JavaScript code similarly with a function call:
public
keyword or dedicated getter functions.ethers.js
, web3.js
) or Remix IDE.