Ethereum React Native Boilerplate Questions

No, I don’t think you need.
The example I came up with refers to a smart contract transaction that modifies the state.
The user needs to sign this transaction in order for the state to be modified.
A pure function does not modify the state, you only read the state, therefore there is no need to specify gas either, you just need to make a “call” to get the result from.
If you do it through moralis you can use “runContractFunction” for read-only calls:
https://docs.moralis.io/moralis-server/web3-sdk/native

But you can also do it with the web3 object as well as shown here!
https://web3js.readthedocs.io/en/v1.2.4/web3-eth-contract.html#id25

myContract.methods.myMethod(123).call({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'}, function(error, result){
    ...
});
1 Like

I reran in remix and found that Internal rpc can be sent for transactions that fail - on require. Ugh wallet connect doesn’t pass the error message on react native. So I just need to ensure I am meeting my contracts requirements. Nothing wrong here :sweat_smile:

1 Like

i am getting this error for yarn start , any help will be appreciated .

Starting the development server…

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\NormalModule.js:471:10)
at C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\NormalModule.js:503:5
at C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\NormalModule.js:358:12
at C:\DEV\ethereum-boilerplate\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (C:\DEV\ethereum-boilerplate\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (C:\DEV\ethereum-boilerplate\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
C:\DEV\ethereum-boilerplate\node_modules\react-scripts\scripts\start.js:19
throw err;
^

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\NormalModule.js:417:16)
at C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\NormalModule.js:452:10
at C:\DEV\ethereum-boilerplate\node_modules\webpack\lib\NormalModule.js:323:13
at C:\DEV\ethereum-boilerplate\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at C:\DEV\ethereum-boilerplate\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (C:\DEV\ethereum-boilerplate\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at C:\DEV\ethereum-boilerplate\node_modules\react-scripts\node_modules\babel-loader\lib\index.js:59:103 {
opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ],
library: ‘digital envelope routines’,
reason: ‘unsupported’,
code: ‘ERR_OSSL_EVP_UNSUPPORTED’
}

Node.js v17.2.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS C:\DEV\ethereum-boilerplate>

@BTCbullDOG if you have node v17 and and above, try downgrading to node v16.13.0. And also try to post this in Ethereum Boilerplate forum. Thanks!

For the WalletConnect problem there is an answer in this forum to fix it. In AndroidManifest file from android/app/src/main paste this

<queries>
<package android:name="io.metamask"/>
<package android:name="com.wallet.crypto.trustapp"/>
</queries>

inside it and it should work. I’m using API version 32 of android emulator and it works perfectly.

Same here for the “ERR_OSSL_EVP_UNSUPPORTED” error,

I found another solution, given in StackOverflow :

I added the following to node_modules\react-scripts\config\webpack.config.js
(i did at line 77…)

const crypto = require("crypto");
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);

and then “yarn start” runs without problems

I did this it opens wallet and when I click back button nothing happens in the app!

Will the React Native Boilerplate be receiving moralis and react-moralis updated packages soon?
I have tried to update myself but anything above 0.0.99 for moralis package I cant get working.

@ivan

Is it an idea to add this code solution permanent to the node_modules\react-scripts\config\webpack.config.js for the “ERR_OSSL_EVP_UNSUPPORTED” error?

I want to add push notification for my mobile wallet. I am using moralis rest api, cloud functions and sync feature. I created a sync and watch contract events. I am watching for Transfer events with beforeConsume cloud function. But the log of the transactions is 1.5-2 hours behind. So i can not send real time push to wallets. How can i receive real time push notifications for my wallet transactions? I am using one signal for notification integration. Thank you in advance for your help and ideas.

Hey, I tried this react-native boilerplate its installing successfully
After installing on crypto login button click its opening browser and wallet connect page its going and stops there showing no page found
How to resolve this error?

can i have test token in RN moralis to test transfer ?

you can create a separate thread for this, you should not use beforeConsume, you should use a Nitro server (any new server is a nitro server), you can also add logging to see when that event happens

there shouldn’t be a delay like that
you can also share the server url

@cryptokid


I have use Moralis ethereum RN boilerplate when I try to transfer it rediredts me to metamask wallet but not doing anything like not opening confirm payment dialogue. can you please guide me

I can move all the content to create seperate thread if you mean to ask my question on another topic.
My server url: https://dgh8t1xlpfeh.usemoralis.com:2053/server
I do not know if my server is nitro. I understand that if i do not use beforeConsume and add logging to events then i can see the transfer events without delay.

Thanks its working can you please tell me how to send erc20 tokens

this is a nitro server, because it has coreservices plugin
you can try to use afterSave

Thank you for the response, I just updated my server instance to nitro. I tried with afterSave and i received erc20 real time events. I have one more and last question. Is there any way to receive native token events through moralis? Because i can not add contract abi on sync feature.

Thank you.

You choose have a table with all the transactions in real time for the addresses that you add to watch or for current users

@cryptokid


i want to send custom token my own to other address where do i add contractaddress ?