API error while checking like allowance on bsc

Hi, I got timeout from server using Allowance check on bsc network, server is newest

Hey @legenuspl

We have a problem with some functions in Web3 API now, we will notify you when the problem will be solved.

Thank you for your patience :man_mechanic:

No worries Bro, thx!

Can you tell me syntax how to input my api secret key in url?

https://deep-index.moralis.io/api/token/ERC20/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599/price?chain=eth&chain_name=mainnet

i want to use it directly from website to get values in JS using Fetch

tired to find in docs but all are using swagger app in various languages

I looked at https://www.youtube.com/watch?v=hlamp3CIdEI where it is explained :slight_smile:

Is there a way using just url without cloud functions in a safe way not exposing api key ?

// get mainnet transactions for the current user

const userTrans = await Moralis.Web3.getTransactions();

// get BSC transactions for a given address
// with most recent transactions appearing first
const options = { chain: “bsc”, address: “0x…”, order: “desc” };
const transactions = await Moralis.Web3.getTransactions(options);

above sdk code seems easier a lot than API

If you want to use the API - you dont use it from your frontend, instead you use it from your own backend or from a Moralis Cloud Function so that the key is not revealed

I’ll remember :slight_smile: thanks, do you have some logo that i can put on my website to promote you, something like buildwithmoralis? My website is cyberwealth.pro

Hey @legenuspl

You can find Moralis brand resources here:

Looks decent :slight_smile: Thx

fits navbar and i took dark one, have a link set to redirect to moralis.io :slight_smile:

1 Like

How then substitute :

Moralis.initialize(“nsOvHRG0sI17fFwf0CosgwspHnSYxxx”); // Application id from moralis.io
Moralis.serverURL = “https://9c6txxxi.moralis.io:2053/server”; //Server url from moralis.io

as to not lunch it from frontend?

Hey @legenuspl
You can use .env file

ok, but if you compare it with using cloud function to obtain stored API key which of them would be easiest and most secure?

Hi @legenuspl,

In software development, most our important variables are stores in .env files. Based on the environments (development, testing, production) your .env files will change and be hosted in different places respectfully. So, this way is pretty secure and you shouldn’t worry about it.

Hope this helps. Let me know if I answered your question.

Have a great day sir. :slight_smile:

Thanks Bro, I’ll implement it in my app next version :slight_smile: Thanks for sir but call me Mariusz :slight_smile: U 2 have a great day!

1 Like

There are some errors Metamask throws from early as I remember when I started using Moralis:

inpage.js:1 You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3

inpage.js:1 MetaMask: The event ‘close’ is deprecated and may be removed in the future. Please use ‘disconnect’ instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect
_warnOfDeprecation @ inpage.js:1
on @ inpage.js:1

inpage.js:1 MetaMask: ‘ethereum.enable()’ is deprecated and may be removed in the future. Please use the ‘eth_requestAccounts’ RPC method instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1102

I think is the way user = await Moralis.Web3.authenticate(); Moralis handle authentication and communication with MM.

Would these be addressed in future, and moving to new methods?

1 Like

Hey @legenuspl

Soon the SDK will be redesigned for new web3 methods. Now it doesn’t affect the work of web3 functions in any way.

1 Like

Thanks for nice update. Recently I started getting strange error with some policy I believe:

moralis.js:1 Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep

any ideas?

Also with whom should I speak to have Moralis partnership with my project?

@legenuspl Have you migrated all api requests to backend or moralis cloud functions?