In this thread please ask any questions about Moralis Project âBuild Medium Clone!â that will be going
live on the 18th of June. We will help right away!
Project video:
https://www.youtube.com/watch?v=8S8unFCq0fM
In this thread please ask any questions about Moralis Project âBuild Medium Clone!â that will be going
live on the 18th of June. We will help right away!
Project video:
https://www.youtube.com/watch?v=8S8unFCq0fM
[email protected]: The engine "node" is incompatible with this module. Expected version "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0". Got "16.5.0"
[email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
error [email protected]: The engine "node" is incompatible with this module. Expected version "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0". Got "16.5.0"
error Found incompatible module.
You can try switch your node to version 16.10.0
v16.5.0
this version i have install
You can still downgrade it or install both and switch between versions using nvm
yes ⌠thanks I am search how update node thanksâŚ
yeeeesss thanks only update node and ready thanks
Hi! I am trying to do the Medium project, however, I do not understand why when I am tryna connect my MM wallet, I am somehow stuck in the process. I sign the request from my MM, but i cannot enter the app. It is stuck on the second picture IDK why!
It is related to the App.js file I suppose
Cannot read property 'slice' of undefined
You can check if you got some errors in your console
Youâre trying to call slice
method on a property thatâs not defined as mentioned. You can make a little fix by adding a question mark before the slice like ?.slice
, this will call slice if the variable exist or you can find a way to make sure the variable is defined
address(this)
is the contract address where this transfer
function is being run on. So that will transfer the contractâs balance to the msg.sender (the address calling the contract) - the purpose is to âreturn oversupplied feesâ. The tutorial should cover what each part of the contract does.
Got it thanks. Watched the video.
Quick question:
How would I add multiple chains that Moralis doesnât support yet?
Mainly I would like add: HarmonyONE Testnet.
Would I just use the HarmonyONE Testnet RPC? and put it into the code?
I tried looking here but Moralis doesnât support Harmony yet: https://docs.moralis.io/moralis-dapp/web3-api/supported-chains
Is there a way to manually add chains with the chain ID and RPC and block explorer info?
Also, in the video Jay only chose the polygon mumbai chain but I want to use multiple testnets.
Also, if you want me to learn and want to not give the exact answer then can you tell which docs to look at any tutorials I should look up?
Would I change the code like this here:
For the HomeAuth.js
const options = {
chain: "mumbai",
address: "xxxx",
};
const options = {
chain: "avalanche testnet",
address: "xxxx",
};
const options = {
chain: "bsc testnet",
address: "xxxx",
};
const options = {
chain: "goerli",
address: "xxxx",
};```
And For MyBlogs.js:
const options = {
chain: "mumbai",
address: account,
token_address: "xxx",
};
const options = {
chain: "avalanche testnet",
address: account,
token_address: "xxxx",
};
const options = {
chain: "bsc testnet",
address: account,
token_address: "xxxx",
};
const options = {
chain: "goerli",
address: account,
token_address: "xxxx",
};
And For NewStory.js:
How would I make it so that:
If wallet is connect to BSC testnet then use this contract address and same for rest of the chains.
Or can I just add the other contract addresses below it like this:
let options ={
contractAddress: "xxxx",
contractAddress: "xxxx",
contractAddress: "xxxx",
contractAddress: "xxxx",
functionName: "safeMint",
abi: [
{
inputs: [
{
internalType: "address",
name: "to",
type: "address",
},
{
internalType: "string",
name: "uri",
type: "string",
},
],
name: "safeMint",
outputs: [],
stateMutability: "payable",
type: "function",
},
],
params: {
to: account,
uri: uri,
},
msgValue: Moralis.Units.ETH(1),
}
Iâm guessing I would need to specify which contracts are for which chain and Iâm guessing it wouldnât automatically just work on every chain because, there is no specifications yet for what the contract address is for that chain?
Or am I totally wrong and moralis can just handle all of that and all I need to is something really simple like putting all of the contract addresses in one place?
How would I add multiple chains that Moralis doesnât support yet?
Yes as Harmony isnât supported by Moralis then use of the Moralis API or syncing data to server for that chain wonât work.
Also, in the video Jay only chose the polygon mumbai chain but I want to use multiple testnets.
If you want to change the chain used, you will need to deploy the Medium smart contract on that chain and then change those options
objects.
If wallet is connect to BSC testnet then use this contract address and same for rest of the chains.
You can do a check for the userâs current chain (you can use chainId
from the useMoralis hook) and then change the chain used in any options.
let options ={
contractAddress: âxxxxâ,
contractAddress: âxxxxâ,
contractAddress: âxxxxâ,
contractAddress: âxxxxâ,
You wonât be able to do this, you can use only one contractAddress. Same as above, based on the current chainId, you could select the right contract address from an object of addresses (maybe in a separate .js file that you import).
This makes sense thank you.
Question: How would I make it so that I put in details for multiple contracts and multiple chains?
Letâs say you deploy the Medium Final Contract on BSC Testnet, Avax Testnet & ETH Goerli Testnet
Then how would you specify the custom contract addresses for each of those chains? and allow the dapp to automatically switch either of those chains when a user is on one of those chains?
You can have all the contracts in an object and then you could use chainId
from useMoralis to get the current chain and select the right address.
function Component() {
const { chainId } = useMoralis();
async function run() {
const contracts = {
'0x13881': 'mumbaiaddress', // Mumbai
'0x61': 'bsctestnetaddress', // BSC testnet
};
let options = {
contractAddress: contracts[chainId],
// rest of code
};
// rest of code
}
}
This was really helpful thank you very much!