MoralisWeb3 / Moralis-JS-SDK

Moralis Official Javascript SDK
https://docs.moralis.io
Other
368 stars 257 forks source link

Option to pass baseUrl to EvmApi #1080

Closed shrpne closed 1 year ago

shrpne commented 1 year ago

New Feature Request

Checklist

Current Limitation

Currently it's impossible to override baseUrl in EvmApi

Feature / Enhancement Description

Please add option to pass custom baseUrl to EvmApi create function and constructor

b4rtaz commented 1 year ago

Hello @shrpne! Could you describe a bit reasons why you need it?

shrpne commented 1 year ago

I use Moralis SDK on the web, i can't use default api url deep-index.moralis.io/api for few reasons:

So i use thin proxy, which adds apiKey to requests and adds CORS headers to responses. And i need to pass url of my proxy to SDK

b4rtaz commented 1 year ago

We like this idea. We will add this feature soon. Meanwhile you can fork the repo and work on the local version.

b4rtaz commented 1 year ago

Hello @shrpne! Could you check the 2.19.0 version?

  Moralis.start({
    apiKey: '<api_key>',
    evmApiBaseUrl: 'https://my-website.com/moralis-api'
  });

For now you need to set a fake API token, because the SDK requires that. We will change that soon.

shrpne commented 1 year ago

Everything works fine, thank you!