-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: custom base urls.
- Loading branch information
Showing
17 changed files
with
157 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@moralisweb3/evm-api': patch | ||
'moralis': patch | ||
--- | ||
|
||
Added the optional `evmApiBaseUrl` config option. You may replace the default base URL of the EVM API with your own. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@moralisweb3/sol-api': patch | ||
'moralis': patch | ||
--- | ||
|
||
Added the optional `solApiBaseUrl` config option. You may replace the default base URL of the Solana API with your own. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ApiUtils } from '@moralisweb3/api-utils'; | ||
import { Core } from '@moralisweb3/common-core'; | ||
import { Auth } from './Auth'; | ||
|
||
describe('Auth', () => { | ||
function setupAuth() { | ||
const core = Core.create(); | ||
const apiUtils = ApiUtils.create(core); | ||
const auth = Auth.create(core); | ||
core.registerModules([apiUtils, auth]); | ||
|
||
return { core, auth }; | ||
} | ||
|
||
it('returns default baseUrl', () => { | ||
const { auth } = setupAuth(); | ||
|
||
expect(auth.baseUrl).toBe('https://authapi.moralis.io'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ApiUtils } from '@moralisweb3/api-utils'; | ||
import { Core } from '@moralisweb3/common-core'; | ||
import { SolApi } from './SolApi'; | ||
|
||
describe('SolApi', () => { | ||
function setupSolApi() { | ||
const core = Core.create(); | ||
const apiUtils = ApiUtils.create(core); | ||
const solApi = SolApi.create(core); | ||
core.registerModules([apiUtils, solApi]); | ||
|
||
return { core, solApi }; | ||
} | ||
|
||
it('returns default baseUrl', () => { | ||
const { solApi } = setupSolApi(); | ||
|
||
expect(solApi.baseUrl).toBe('https://solana-gateway.moralis.io'); | ||
}); | ||
|
||
it('supports custom baseUrl', () => { | ||
const customBaseUrl = 'https://custom-sol-api-url.com'; | ||
|
||
const { core, solApi } = setupSolApi(); | ||
|
||
core.config.set('solApiBaseUrl', customBaseUrl); | ||
|
||
expect(solApi.baseUrl).toBe(customBaseUrl); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ConfigKey } from '@moralisweb3/common-core'; | ||
|
||
export const SolApiConfig = { | ||
solApiBaseUrl: { | ||
name: 'solApiBaseUrl', | ||
defaultValue: 'https://solana-gateway.moralis.io', | ||
} as ConfigKey<string>, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Config } from '@moralisweb3/common-core'; | ||
import { SolApiConfig } from './SolApiConfig'; | ||
|
||
export class EvmSolApiConfigSetup { | ||
public static register(config: Config) { | ||
config.registerKey(SolApiConfig.solApiBaseUrl); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ApiUtils } from '@moralisweb3/api-utils'; | ||
import { Core } from '@moralisweb3/common-core'; | ||
import { Streams } from './Streams'; | ||
|
||
describe('Streams', () => { | ||
function setupStreams() { | ||
const core = Core.create(); | ||
const apiUtils = ApiUtils.create(core); | ||
const streams = Streams.create(core); | ||
core.registerModules([apiUtils, streams]); | ||
|
||
return { core, streams }; | ||
} | ||
|
||
it('returns default baseUrl', () => { | ||
const { streams } = setupStreams(); | ||
|
||
expect(streams.baseUrl).toBe('https://api.moralis-streams.com'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d6f6476
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test coverage