🦊 [Plugin] Web3 & MetaMask by NovaBloq

Hello dev, how can i format a JSON response from my contract in a plain text.
Example:
The responde JSON from contract is:

{“0”:“0”,“1”:“0”,“2”:“1639536271”,“amount”:“350000000000000000000”,“rewardDebt”:“0”,“nextWithdrawalUntil”:“1639536271”}

How can i use only “amount 350000000000000000000” field on my app?

Yes of course, just use your smart contract address.

You can extract it using Bubble find and replace or a regex pattern . There are a few json plugin aswell, maybe try one of them.
Since for each contract the response will be different, we couldn’t do it on the plugin side so we show the full response as a text and letting users work with it however they want.

3 Likes

It seems that the ‘Disconnect Metamask’ function is not working. Connecting to Metamask works fine, however my wallet remains connected to the site after triggering the disconnect function. I am using the latest version of the plugin. Please advise if you can replicate this issue. Thank you.

Disconnecting completely from the Metamask is not possible, this feature from the plugin disconnects only the app from the Metamas and not the Metamask from the app.
To completely disconnect, you have to manually do it.

1 Like

Thank you.

I’m getting this error in the debugger when using the Get Token Balance Action today. It’s the first time I’ve seen it.

“The plugin Web3 & Metamask / action Get Balance of Token a Web3 & MetaMask threw the following error: TypeError: Cannot read properties of undefined (reading ‘toUpperCase’)
at getTokenSymbol (PLUGIN_1612784921335x464807902025875460/Web3—Metamask-element_action–Web3—MetaMask-Get-Balance-of-Token-.js:23:69)
at eval (PLUGIN_1612784921335x464807902025875460/Web3—Metamask-element_action–Web3—MetaMask-Get-Balance-of-Token-.js:32:5) (please report this to the plugin author)”

any news on pluggin that spends using your private keys yet :slight_smile: ?

In work :slight_smile:

is there a way to send a switch network request to user where he can approves it and Dapp switch the network for him ?

Yes, check the plugin element settings, the field called “Auto-trigger change network request on MetaMask”

1 Like

wow really cool , thanks

Hi @ezdev , I have try to pull the metadata of this Bored Ape in your demo page but it doesn’t return anything where as the NFT you linked above works fine. What is the difference or why isn’t it working?

Hi, there was a small bug in this action, we have fixed it, check the demo page now :wink:

Yes it works now for that NFT. Thanks. But what are the condition for it to work. Is it supposed to work for any minted NFT? This one for example, doesn’T return anything.

It all depends on where the json file was uploaded, if it is on a custom server (not on IPFS), it may return errors.

This example is uploaded on a custom heroku server causing fetching errors.
Thank you for the feedback, I’ll do an update to return at least the link to the json if the json cannot be reached by the plugin.

1 Like

That’d be great if you could add some alerts whenever there is an error like this one.

does a swap on ETH chain works the same way as the one in the example ? (beside changing to Uniswap router and ABI ) but everything else is the same ?

Yes, same thing just different contracts

thanks , BSC works well but when changing to ETH with its uniswapV2 router address i returns incorrect values from wei results like in the image , you know what could be the issue ?

Hard to say without the proper context, but from and to Wei works as expected on any chain, you can test it here