New answers tagged

1

The issue is that you are missing a / in your URL. The following line should have https:// and not https:/. RPC = 'https:/rinkeby.infura.io/v3/${process.env.INFURA_API_KEY_RINKEBY}';


0

Have you tried reading the docs on the @truffle/contract docs? https://www.npmjs.com/package/@truffle/contract There are several steps to do before including the truffle-contract.min.js file in the index.html.


1

The question is pure javascript one and has nothing to do with Ethereum, but I will give you the answer, because you're a new contributor and I hope next time you will pay more attention to keep this forum only Ethereum related. var arr = [0, 0, 1602907512, 1602907764, 1602907512, 1602907764, 60000000, 90000000]; var outcomeArr = []; var tempCounter = 0; ...


1

In JavaScript, We suppose you defined your contract object in a variable called `MyContract'. By the below statement, in an async function, you can get array result: let MyContractOutput= await MyContract.methods.getPlayerDeposit(<Give an address>).call(); By this way, you get the result like this: 0,1602907512,1602907512,60000000 In order that you ...


1

I assume you want to convert the BigNumber into a normal number, you can do that by: result[0].toNumber() But keep in mind that JavaScript's Number is a 64 bit number, so the uint256 in your solidity contract might not always be shrinked down to 64 bits. A safer way to to that is to keep the number in String, if you don't want to do any additions or ...


2

MetaMask does not provide a way to get the private key through code by design. Any interaction with accounts in MetaMask has to be done through the Web3 API, to prevent a (malicious) website from stealing a user's private keys.


0

You should try it: let currentValue = await contract.methods.getBadgeOwner('withdraw').call(); Good Luck!


Top 50 recent answers are included