From 263779db9c5c6c7c8c7580d28c36cf02b524c3ef Mon Sep 17 00:00:00 2001 From: Bart Tadych Date: Wed, 24 Aug 2022 11:34:42 +0200 Subject: [PATCH] deleted BASE_URL from endpoint definitions. (#604) * deleted BASE_URL from endpoint definitions. --- .changeset/config.json | 10 ++++- .../src/middlewares/errorHandler.ts | 7 +++- .../src/resolvers/EndpointParamsReader.ts | 4 +- .../src/resolvers/EndpointResolver.test.ts | 3 +- .../src/resolvers/EndpointResolver.ts | 39 ++++++++----------- packages/apiUtils/src/resolvers/Endpoints.ts | 15 ++----- .../PaginatedEndpointResolver.test.ts | 3 +- .../resolvers/PaginatedEndpointResolver.ts | 30 ++++++++------ packages/auth/src/methods/requestMessage.ts | 3 +- packages/auth/src/methods/verify.ts | 3 +- .../auth/src/resolvers/evmRequestChallenge.ts | 3 +- .../auth/src/resolvers/evmVerifyChallenge.ts | 3 +- .../core/src/controllers/RequestController.ts | 12 +++--- packages/evmApi/src/EvmApi.ts | 2 +- .../src/resolvers/account/getNFTTransfers.ts | 3 +- .../evmApi/src/resolvers/account/getNFTs.ts | 3 +- .../resolvers/account/getNFTsForContract.ts | 3 +- .../src/resolvers/account/getNativeBalance.ts | 3 +- .../src/resolvers/account/getTokenBalances.ts | 3 +- .../resolvers/account/getTokenTransfers.ts | 3 +- .../src/resolvers/account/getTransactions.ts | 3 +- .../src/resolvers/defi/getPairAddress.ts | 3 +- .../src/resolvers/defi/getPairReserves.ts | 3 +- .../src/resolvers/info/endpointWeights.ts | 3 +- .../src/resolvers/info/web3ApiVersion.ts | 3 +- .../evmApi/src/resolvers/native/getBlock.ts | 3 +- .../src/resolvers/native/getContractEvents.ts | 3 +- .../src/resolvers/native/getDateToBlock.ts | 3 +- .../src/resolvers/native/getLogsByAddress.ts | 3 +- .../native/getNFTTransfersByBlock.ts | 3 +- .../src/resolvers/native/getTransaction.ts | 3 +- .../resolvers/native/runContractFunction.ts | 3 +- .../src/resolvers/resolve/resolveAddress.ts | 3 +- .../src/resolvers/resolve/resolveDomain.ts | 3 +- .../src/resolvers/storage/uploadFolder.ts | 3 +- .../src/resolvers/token/getAllTokenIds.ts | 3 +- .../token/getContractNFTTransfers.ts | 3 +- .../src/resolvers/token/getNFTLowestPrice.ts | 3 +- .../src/resolvers/token/getNFTMetadata.ts | 3 +- .../src/resolvers/token/getNFTOwners.ts | 3 +- .../src/resolvers/token/getNFTTrades.ts | 3 +- .../token/getNftTransfersFromToBlock.ts | 3 +- .../token/getTokenAddressTransfers.ts | 3 +- .../src/resolvers/token/getTokenAllowance.ts | 3 +- .../src/resolvers/token/getTokenIdMetadata.ts | 3 +- .../src/resolvers/token/getTokenIdOwners.ts | 3 +- .../src/resolvers/token/getTokenMetadata.ts | 3 +- .../token/getTokenMetadataBySymbol.ts | 3 +- .../src/resolvers/token/getTokenPrice.ts | 3 +- .../token/getWalletTokenIdTransfers.ts | 3 +- .../src/resolvers/token/reSyncMetadata.ts | 3 +- .../evmApi/src/resolvers/token/searchNFTs.ts | 3 +- .../src/resolvers/token/syncNFTContract.ts | 3 +- packages/solApi/src/MoralisSolApi.ts | 2 +- .../src/resolvers/account/getBalance.ts | 3 +- .../solApi/src/resolvers/account/getNFTs.ts | 3 +- .../src/resolvers/account/getPortfolio.ts | 3 +- .../solApi/src/resolvers/account/getSPL.ts | 3 +- .../src/resolvers/nft/getNFTMetadata.ts | 3 +- 59 files changed, 118 insertions(+), 153 deletions(-) diff --git a/.changeset/config.json b/.changeset/config.json index 5cc2ebf166..79d3860eb9 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -18,5 +18,13 @@ "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", - "ignore": ["test-integration", "test-node", "demo-nextjs", "demo-parse-server", "demo-subabase-auth"] + "ignore": [ + "test-integration", + "demo-cli", + "demo-nextjs", + "demo-parse-server", + "demo-subabase-auth", + "demo-firebase-auth-functions", + "demo-firebase-proxy-functions" + ] } diff --git a/demos/parse-server/src/middlewares/errorHandler.ts b/demos/parse-server/src/middlewares/errorHandler.ts index a1d4315f33..15150f3d7d 100644 --- a/demos/parse-server/src/middlewares/errorHandler.ts +++ b/demos/parse-server/src/middlewares/errorHandler.ts @@ -24,7 +24,12 @@ const makeMoralisErrorMessage = (error: MoralisError) => { return message; }; -export function errorHandler(error: Error | MoralisError | AxiosError, req: Request, res: Response, _next: NextFunction) { +export function errorHandler( + error: Error | MoralisError | AxiosError, + req: Request, + res: Response, + _next: NextFunction, +) { // eslint-disable-next-line no-console console.error('ErrorHandler', error); diff --git a/packages/apiUtils/src/resolvers/EndpointParamsReader.ts b/packages/apiUtils/src/resolvers/EndpointParamsReader.ts index be06a98cfc..7625b7f99e 100644 --- a/packages/apiUtils/src/resolvers/EndpointParamsReader.ts +++ b/packages/apiUtils/src/resolvers/EndpointParamsReader.ts @@ -17,7 +17,7 @@ export class EndpointParamsReader { return Object.keys(params).reduce((result, key) => { const paramKey = key as keyof ApiParams; @@ -26,7 +26,7 @@ export class EndpointParamsReader); } public getBodyParams(params: ApiParams) { diff --git a/packages/apiUtils/src/resolvers/EndpointResolver.test.ts b/packages/apiUtils/src/resolvers/EndpointResolver.test.ts index 69240c000a..2741def923 100644 --- a/packages/apiUtils/src/resolvers/EndpointResolver.test.ts +++ b/packages/apiUtils/src/resolvers/EndpointResolver.test.ts @@ -54,10 +54,11 @@ describe('ApiResolver', () => { beforeEach(() => { resolver = EndpointResolver.create( core, + API_ROOT, createEndpointFactory(() => createEndpoint({ name: 'endpointWeights', - getUrl: () => `${API_ROOT}/info/endpointWeights`, + getUrl: () => '/info/endpointWeights', apiToResult: (data: EndpointWeight) => ({ endpoint: data.endpoint, weight: parseInt(data.weight), diff --git a/packages/apiUtils/src/resolvers/EndpointResolver.ts b/packages/apiUtils/src/resolvers/EndpointResolver.ts index 120d138190..829cecbe63 100644 --- a/packages/apiUtils/src/resolvers/EndpointResolver.ts +++ b/packages/apiUtils/src/resolvers/EndpointResolver.ts @@ -8,16 +8,18 @@ import { getCommonHeaders } from './getCommonHeaders'; export class EndpointResolver { public static create( core: MoralisCore, + baseUrl: string, endpointFactory: EndpointFactory, ) { const requestController = RequestController.create(core); const endpoint = endpointFactory(core); const paramsReader = new EndpointParamsReader(endpoint); - return new EndpointResolver(endpoint, core.config, requestController, paramsReader); + return new EndpointResolver(endpoint, baseUrl, core.config, requestController, paramsReader); } public constructor( public readonly endpoint: Endpoint, + private readonly baseUrl: string, private readonly config: Config, private readonly requestController: RequestController, private readonly paramsReader: EndpointParamsReader, @@ -25,14 +27,13 @@ export class EndpointResolver { - const url = this.endpoint.getUrl(params); + const url = this.createUrl(params); const apiParams = this.endpoint.parseParams(params); const searchParams = this.paramsReader.getSearchParams(apiParams); - // @ts-ignore TODO: fix the ApiParams type, as it should extend Searchparams - const result = await this.requestController.get(url, searchParams, { + const result = await this.requestController.get(url, searchParams, { headers: this.createHeaders(), }); @@ -40,43 +41,37 @@ export class EndpointResolver { - const url = this.endpoint.getUrl(params); + const url = this.createUrl(params); const apiParams = this.endpoint.parseParams(params); const searchParams = this.paramsReader.getSearchParams(apiParams); const bodyParams = this.paramsReader.getBodyParams(apiParams); - const result = await this.requestController.post, Record>( - url, - searchParams, - bodyParams, - { - headers: this.createHeaders(), - }, - ); + const result = await this.requestController.post>(url, searchParams, bodyParams, { + headers: this.createHeaders(), + }); return new ApiResultAdapter(result, this.endpoint.apiToResult, this.endpoint.resultToJson, params); }; private put = async (params: Params) => { - const url = this.endpoint.getUrl(params); + const url = this.createUrl(params); const apiParams = this.endpoint.parseParams(params); const searchParams = this.paramsReader.getSearchParams(apiParams); const bodyParams = this.paramsReader.getBodyParams(apiParams); - const result = await this.requestController.put, Record>( - url, - searchParams, - bodyParams, - { - headers: this.createHeaders(), - }, - ); + const result = await this.requestController.put>(url, searchParams, bodyParams, { + headers: this.createHeaders(), + }); return new ApiResultAdapter(result, this.endpoint.apiToResult, this.endpoint.resultToJson, params); }; + private createUrl(params: Params): string { + return this.baseUrl + this.endpoint.getUrl(params); + } + private createHeaders(): { [key: string]: string } { const apiKey = this.config.get(ApiConfig.apiKey); diff --git a/packages/apiUtils/src/resolvers/Endpoints.ts b/packages/apiUtils/src/resolvers/Endpoints.ts index a4496a0536..780b8623a0 100644 --- a/packages/apiUtils/src/resolvers/Endpoints.ts +++ b/packages/apiUtils/src/resolvers/Endpoints.ts @@ -18,16 +18,12 @@ export class Endpoints { // eslint-disable-next-line @typescript-eslint/no-explicit-any private readonly endpoints: Endpoint[] = []; - public constructor( - private readonly core: MoralisCore, - // TODO: the `baseUrl` argument should be removed. - private readonly baseUrl: string, - ) {} + public constructor(private readonly core: MoralisCore, private readonly baseUrl: string) {} public createFetcher( factory: EndpointFactory, ) { - const resolver = EndpointResolver.create(this.core, factory); + const resolver = EndpointResolver.create(this.core, this.baseUrl, factory); this.endpoints.push(resolver.endpoint); return resolver.fetch; } @@ -35,7 +31,7 @@ export class Endpoints { public createPaginatedFetcher( factory: PaginatedEndpointFactory, ) { - const resolver = PaginatedEndpointResolver.create(this.core, factory); + const resolver = PaginatedEndpointResolver.create(this.core, this.baseUrl, factory); this.endpoints.push(resolver.endpoint); return resolver.fetch; } @@ -50,10 +46,7 @@ export class Endpoints { params[paramName] = `{${paramName}}`; return params; }, {}); - const urlPattern = endpoint - .getUrl(urlParams) - // TODO: getUrl() method should NOT return url with baseUrl prefix! - .replace(this.baseUrl, ''); + const urlPattern = endpoint.getUrl(urlParams); return { // DO NOT return baseUrl here! diff --git a/packages/apiUtils/src/resolvers/PaginatedEndpointResolver.test.ts b/packages/apiUtils/src/resolvers/PaginatedEndpointResolver.test.ts index d899dd8ebc..eb1dd6739c 100644 --- a/packages/apiUtils/src/resolvers/PaginatedEndpointResolver.test.ts +++ b/packages/apiUtils/src/resolvers/PaginatedEndpointResolver.test.ts @@ -97,10 +97,11 @@ describe('PaginatedEndpointResolver', () => { beforeEach(() => { resolver = PaginatedEndpointResolver.create( core, + API_ROOT, createPaginatedEndpointFactory(() => createPaginatedEndpoint({ name: 'getContractEvents', - getUrl: (params: Params) => `${API_ROOT}/${params.address}/events`, + getUrl: (params: Params) => `/${params.address}/events`, // TODO: remove PaginatedResponse when api squad make swagger update apiToResult: (data: PaginatedResult) => data.result.map((event) => ({ diff --git a/packages/apiUtils/src/resolvers/PaginatedEndpointResolver.ts b/packages/apiUtils/src/resolvers/PaginatedEndpointResolver.ts index 249b1d5119..e0c893518a 100644 --- a/packages/apiUtils/src/resolvers/PaginatedEndpointResolver.ts +++ b/packages/apiUtils/src/resolvers/PaginatedEndpointResolver.ts @@ -15,16 +15,18 @@ export class PaginatedEndpointResolver< > { public static create( core: MoralisCore, + baseUrl: string, endpointFactory: PaginatedEndpointFactory, ) { const requestController = RequestController.create(core); const endpoint = endpointFactory(core); const paramsReader = new EndpointParamsReader(endpoint); - return new PaginatedEndpointResolver(endpoint, core.config, requestController, paramsReader); + return new PaginatedEndpointResolver(endpoint, baseUrl, core.config, requestController, paramsReader); } public constructor( public readonly endpoint: PaginatedEndpoint, + private readonly baseUrl: string, private readonly config: Config, private readonly requestController: RequestController, private readonly paramsReader: EndpointParamsReader< @@ -38,14 +40,13 @@ export class PaginatedEndpointResolver< // TODO: error handler to ApiError private get = async (params: Params) => { - const url = this.endpoint.getUrl(params); + const url = this.createUrl(params); const apiParams = this.endpoint.parseParams(params); const searchParams = this.paramsReader.getSearchParams(apiParams); - // @ts-ignore TODO: fix the ApiParams type, as it should extend Searchparams - const result = await this.requestController.get, ApiParams>(url, searchParams, { + const result = await this.requestController.get>(url, searchParams, { headers: this.createHeaders(), }); @@ -59,19 +60,20 @@ export class PaginatedEndpointResolver< }; private post = async (params: Params) => { - const url = this.endpoint.getUrl(params); + const url = this.createUrl(params); const apiParams = this.endpoint.parseParams(params); const searchParams = this.paramsReader.getSearchParams(apiParams); const bodyParams = this.paramsReader.getBodyParams(apiParams); - const result = await this.requestController.post< - PaginatedResult, - Record, - Record - >(url, searchParams, bodyParams, { - headers: this.createHeaders(), - }); + const result = await this.requestController.post, Record>( + url, + searchParams, + bodyParams, + { + headers: this.createHeaders(), + }, + ); return new ApiPaginatedResultAdapter( result, @@ -87,6 +89,10 @@ export class PaginatedEndpointResolver< return checkObjEqual(params, nextParams) ? undefined : () => this.fetch(nextParams); }; + private createUrl(params: Params): string { + return this.baseUrl + this.endpoint.getUrl(params); + } + private createHeaders(): { [key: string]: string } { const apiKey = this.config.get(ApiConfig.apiKey); if (!apiKey) { diff --git a/packages/auth/src/methods/requestMessage.ts b/packages/auth/src/methods/requestMessage.ts index f47bcd2f44..64098bf8d6 100644 --- a/packages/auth/src/methods/requestMessage.ts +++ b/packages/auth/src/methods/requestMessage.ts @@ -1,6 +1,7 @@ import { EndpointResolver } from '@moralisweb3/api-utils'; import MoralisCore, { AuthErrorCode, MoralisAuthError } from '@moralisweb3/core'; import { EvmAddress, EvmAddressish, EvmChain, EvmChainish } from '@moralisweb3/evm-utils'; +import { BASE_URL } from '../MoralisAuth'; import { initializeChallenge } from '../resolvers/evmRequestChallenge'; export enum AuthNetwork { @@ -31,7 +32,7 @@ const makeEvmRequestMessage = ( core: MoralisCore, { chain, address, network, ...options }: RequestMessageEvmOptions, ) => { - return EndpointResolver.create(core, initializeChallenge).fetch({ + return EndpointResolver.create(core, BASE_URL, initializeChallenge).fetch({ chainId: EvmChain.create(chain).decimal, address: EvmAddress.create(address).checksum, ...options, diff --git a/packages/auth/src/methods/verify.ts b/packages/auth/src/methods/verify.ts index e39da977b4..4f39a0acaf 100644 --- a/packages/auth/src/methods/verify.ts +++ b/packages/auth/src/methods/verify.ts @@ -1,5 +1,6 @@ import { EndpointResolver } from '@moralisweb3/api-utils'; import MoralisCore, { assertUnreachable } from '@moralisweb3/core'; +import { BASE_URL } from '../MoralisAuth'; import { completeChallenge } from '../resolvers/evmVerifyChallenge'; export interface VerifyEvmOptions { @@ -12,7 +13,7 @@ export type VerifyOptions = VerifyEvmOptions; // eslint-disable-next-line @typescript-eslint/no-unused-vars const makeEvmVerify = (core: MoralisCore, { network, ...options }: VerifyEvmOptions) => { - return EndpointResolver.create(core, completeChallenge).fetch({ + return EndpointResolver.create(core, BASE_URL, completeChallenge).fetch({ message: options.message, signature: options.signature, }); diff --git a/packages/auth/src/resolvers/evmRequestChallenge.ts b/packages/auth/src/resolvers/evmRequestChallenge.ts index ec272eabfb..60785c67cd 100644 --- a/packages/auth/src/resolvers/evmRequestChallenge.ts +++ b/packages/auth/src/resolvers/evmRequestChallenge.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { toCamelCase } from '@moralisweb3/core'; import { operations } from '../generated/types'; -import { BASE_URL } from '../MoralisAuth'; const name = 'requestChallengeEvm'; @@ -35,7 +34,7 @@ const apiToResult = (apiData: ApiResult) => { export const initializeChallenge = createEndpointFactory(() => createEndpoint({ name, - getUrl: () => `${BASE_URL}/challenge/request/evm`, + getUrl: () => `/challenge/request/evm`, apiToResult, resultToJson: (data) => ({ ...data, diff --git a/packages/auth/src/resolvers/evmVerifyChallenge.ts b/packages/auth/src/resolvers/evmVerifyChallenge.ts index b649d9a8fd..158408979f 100644 --- a/packages/auth/src/resolvers/evmVerifyChallenge.ts +++ b/packages/auth/src/resolvers/evmVerifyChallenge.ts @@ -2,7 +2,6 @@ import { maybe, toCamelCase } from '@moralisweb3/core'; import { EvmAddress, EvmChain } from '@moralisweb3/evm-utils'; import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { operations } from '../generated/types'; -import { BASE_URL } from '../MoralisAuth'; const name = 'verifyChallengeEvm'; @@ -18,7 +17,7 @@ type ApiResult = operations[Name]['responses']['201']['content']['application/js export const completeChallenge = createEndpointFactory(() => createEndpoint({ name: 'Verify Challenge (EVM)', - getUrl: () => `${BASE_URL}/challenge/verify/evm`, + getUrl: () => `/challenge/verify/evm`, apiToResult: ({ chainId, ...data }: ApiResult) => ({ ...data, // TODO: revisit EVM logic once we know how authentication in other networks work diff --git a/packages/core/src/controllers/RequestController.ts b/packages/core/src/controllers/RequestController.ts index f85aa30280..6523f76210 100644 --- a/packages/core/src/controllers/RequestController.ts +++ b/packages/core/src/controllers/RequestController.ts @@ -95,9 +95,9 @@ export class RequestController { }); } - public post, Body extends Record>( + public post>( url: string, - searchParams?: SearchParams, + searchParams?: Record, body?: Body, options?: RequestOptions, abortSignal?: AbortController['signal'], @@ -112,9 +112,9 @@ export class RequestController { }); } - public put, Body extends Record>( + public put>( url: string, - searchParams?: SearchParams, + searchParams?: Record, body?: Body, options?: RequestOptions, abortSignal?: AbortController['signal'], @@ -129,9 +129,9 @@ export class RequestController { }); } - public async get>( + public async get( url: string, - searchParams?: SearchParams, + searchParams?: Record, options?: RequestOptions, abortSignal?: AbortController['signal'], ): Promise { diff --git a/packages/evmApi/src/EvmApi.ts b/packages/evmApi/src/EvmApi.ts index ab32166789..5458fdb84e 100644 --- a/packages/evmApi/src/EvmApi.ts +++ b/packages/evmApi/src/EvmApi.ts @@ -44,7 +44,7 @@ import { uploadFolder } from './resolvers/storage'; import { EvmApiConfigSetup } from './config/EvmApiConfigSetup'; import { Endpoints } from '@moralisweb3/api-utils'; -export const BASE_URL = 'https://deep-index.moralis.io/api/v2'; +const BASE_URL = 'https://deep-index.moralis.io/api/v2'; export class MoralisEvmApi extends ApiModule { public static readonly moduleName = 'evmApi'; diff --git a/packages/evmApi/src/resolvers/account/getNFTTransfers.ts b/packages/evmApi/src/resolvers/account/getNFTTransfers.ts index 3335d24804..50a5a8cc61 100644 --- a/packages/evmApi/src/resolvers/account/getNFTTransfers.ts +++ b/packages/evmApi/src/resolvers/account/getNFTTransfers.ts @@ -1,7 +1,6 @@ import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNative, EvmNftTransfer } from '@moralisweb3/evm-utils'; import { operations } from '../../generated/types'; -import { BASE_URL } from '../../EvmApi'; import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -21,7 +20,7 @@ export const getNFTTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTTransfers', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/nft/transfers`, + getUrl: (params: Params) => `/${params.address}/nft/transfers`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((transfer) => EvmNftTransfer.create({ diff --git a/packages/evmApi/src/resolvers/account/getNFTs.ts b/packages/evmApi/src/resolvers/account/getNFTs.ts index 08d831537f..b3f672ea4b 100644 --- a/packages/evmApi/src/resolvers/account/getNFTs.ts +++ b/packages/evmApi/src/resolvers/account/getNFTs.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpoint, createPaginatedEndpointFactory, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize, dateInputToDate } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNft } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -23,7 +22,7 @@ export const getNFTs = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTs', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/nft`, + getUrl: (params: Params) => `/${params.address}/nft`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((nft) => EvmNft.create({ diff --git a/packages/evmApi/src/resolvers/account/getNFTsForContract.ts b/packages/evmApi/src/resolvers/account/getNFTsForContract.ts index 051cc9818d..a51c1e23e8 100644 --- a/packages/evmApi/src/resolvers/account/getNFTsForContract.ts +++ b/packages/evmApi/src/resolvers/account/getNFTsForContract.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpoint, createPaginatedEndpointFactory, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNft } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -23,7 +22,7 @@ export const getNFTsForContract = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTsForContract', urlParams: ['address', 'tokenAddress'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/nft/${params.tokenAddress}`, + getUrl: (params: Params) => `/${params.address}/nft/${params.tokenAddress}`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? [])?.map((nft) => EvmNft.create({ diff --git a/packages/evmApi/src/resolvers/account/getNativeBalance.ts b/packages/evmApi/src/resolvers/account/getNativeBalance.ts index 3c96e7e3e1..c793ada7aa 100644 --- a/packages/evmApi/src/resolvers/account/getNativeBalance.ts +++ b/packages/evmApi/src/resolvers/account/getNativeBalance.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { EvmAddressish, EvmChainish, EvmNative, EvmAddress } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getNativeBalance = createEndpointFactory((core) => createEndpoint({ name: 'getNativeBalance', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/balance`, + getUrl: (params: Params) => `/${params.address}/balance`, apiToResult: (data: ApiResult) => ({ balance: EvmNative.create(data.balance, 'wei'), }), diff --git a/packages/evmApi/src/resolvers/account/getTokenBalances.ts b/packages/evmApi/src/resolvers/account/getTokenBalances.ts index 58e16837ad..7af826fbd2 100644 --- a/packages/evmApi/src/resolvers/account/getTokenBalances.ts +++ b/packages/evmApi/src/resolvers/account/getTokenBalances.ts @@ -1,7 +1,6 @@ import { Camelize } from '@moralisweb3/core'; import { Erc20Value, EvmAddressish, EvmChainish, EvmAddress } from '@moralisweb3/evm-utils'; import { operations } from '../../generated/types'; -import { BASE_URL } from '../../EvmApi'; import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getTokenBalances = createEndpointFactory((core) => createEndpoint({ name: 'getTokenBalances', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/erc20`, + getUrl: (params: Params) => `/${params.address}/erc20`, apiToResult: (data: ApiResult, params: Params) => { return (data ?? []).map((token) => Erc20Value.create(token.balance, { diff --git a/packages/evmApi/src/resolvers/account/getTokenTransfers.ts b/packages/evmApi/src/resolvers/account/getTokenTransfers.ts index 3bffe71ab9..03a5a8818c 100644 --- a/packages/evmApi/src/resolvers/account/getTokenTransfers.ts +++ b/packages/evmApi/src/resolvers/account/getTokenTransfers.ts @@ -2,7 +2,6 @@ import { BigNumber, Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, Erc20Transfer } from '@moralisweb3/evm-utils'; import { operations } from '../../generated/types'; import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; -import { BASE_URL } from '../../EvmApi'; import { EvmChainResolver } from '../EvmChainResolver'; type operation = 'getTokenTransfers'; @@ -22,7 +21,7 @@ export const getTokenTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getTokenTransfers', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/erc20/transfers`, + getUrl: (params: Params) => `/${params.address}/erc20/transfers`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((transfer) => Erc20Transfer.create({ diff --git a/packages/evmApi/src/resolvers/account/getTransactions.ts b/packages/evmApi/src/resolvers/account/getTransactions.ts index 55b8e5d042..46b60163cd 100644 --- a/packages/evmApi/src/resolvers/account/getTransactions.ts +++ b/packages/evmApi/src/resolvers/account/getTransactions.ts @@ -2,7 +2,6 @@ import { BigNumber, Camelize } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmTransaction } from '@moralisweb3/evm-utils'; import { operations } from '../../generated/types'; import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; -import { BASE_URL } from '../../EvmApi'; import { EvmChainResolver } from '../EvmChainResolver'; type operation = 'getTransactions'; @@ -21,7 +20,7 @@ export const getTransactions = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getTransactions', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}`, + getUrl: (params: Params) => `/${params.address}`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((transaction) => EvmTransaction.create({ diff --git a/packages/evmApi/src/resolvers/defi/getPairAddress.ts b/packages/evmApi/src/resolvers/defi/getPairAddress.ts index 56cdb1e497..4de0dd718a 100644 --- a/packages/evmApi/src/resolvers/defi/getPairAddress.ts +++ b/packages/evmApi/src/resolvers/defi/getPairAddress.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { Erc20Token, EvmAddress, EvmAddressish, EvmChainish } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -23,7 +22,7 @@ export const getPairAddress = createEndpointFactory((core) => createEndpoint({ name: 'getPairAddress', urlParams: ['token0Address', 'token1Address'], - getUrl: (params: Params) => `${BASE_URL}/${params.token0Address}/${params.token1Address}/pairAddress`, + getUrl: (params: Params) => `/${params.token0Address}/${params.token1Address}/pairAddress`, // TODO: refactor to reduce complexity // eslint-disable-next-line complexity apiToResult: (data: ApiResult, params: Params) => ({ diff --git a/packages/evmApi/src/resolvers/defi/getPairReserves.ts b/packages/evmApi/src/resolvers/defi/getPairReserves.ts index 29d8302a53..77dbeebfaa 100644 --- a/packages/evmApi/src/resolvers/defi/getPairReserves.ts +++ b/packages/evmApi/src/resolvers/defi/getPairReserves.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { EvmAddress, EvmAddressish, EvmChainish } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getPairReserves = createEndpointFactory((core) => createEndpoint({ name: 'getPairReserves', urlParams: ['pairAddress'], - getUrl: (params: Params) => `${BASE_URL}/${params.pairAddress}/reserves`, + getUrl: (params: Params) => `/${params.pairAddress}/reserves`, apiToResult: (data: ApiResult) => data, resultToJson: (data) => data, parseParams: (params: Params): ApiParams => ({ diff --git a/packages/evmApi/src/resolvers/info/endpointWeights.ts b/packages/evmApi/src/resolvers/info/endpointWeights.ts index b13bf3153c..f6ce057d9f 100644 --- a/packages/evmApi/src/resolvers/info/endpointWeights.ts +++ b/packages/evmApi/src/resolvers/info/endpointWeights.ts @@ -1,6 +1,5 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; type operation = 'endpointWeights'; @@ -10,7 +9,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const endpointWeights = createEndpointFactory(() => createEndpoint({ name: 'endpointWeights', - getUrl: () => `${BASE_URL}/info/endpointWeights`, + getUrl: () => `/info/endpointWeights`, apiToResult: (data: ApiResult) => data, resultToJson: (data) => data, parseParams: (params) => params, diff --git a/packages/evmApi/src/resolvers/info/web3ApiVersion.ts b/packages/evmApi/src/resolvers/info/web3ApiVersion.ts index a7ae0daa0b..7694070af9 100644 --- a/packages/evmApi/src/resolvers/info/web3ApiVersion.ts +++ b/packages/evmApi/src/resolvers/info/web3ApiVersion.ts @@ -1,5 +1,4 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; type operation = 'web3ApiVersion'; @@ -9,7 +8,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const web3ApiVersion = createEndpointFactory(() => createEndpoint({ name: 'web3ApiVersion', - getUrl: () => `${BASE_URL}/web3/version`, + getUrl: () => `/web3/version`, apiToResult: (data: ApiResult) => data, resultToJson: (data) => data, parseParams: (params) => params, diff --git a/packages/evmApi/src/resolvers/native/getBlock.ts b/packages/evmApi/src/resolvers/native/getBlock.ts index 9e2e8c762c..b0b62e510e 100644 --- a/packages/evmApi/src/resolvers/native/getBlock.ts +++ b/packages/evmApi/src/resolvers/native/getBlock.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import MoralisCore, { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmTransaction, EvmTransactionLog, EvmBlock } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -65,7 +64,7 @@ export const getBlock = createEndpointFactory((core) => createEndpoint({ name: 'getBlock', urlParams: ['blockNumberOrHash'], - getUrl: (params: Params) => `${BASE_URL}/block/${params.blockNumberOrHash}`, + getUrl: (params: Params) => `/block/${params.blockNumberOrHash}`, apiToResult: (result: ApiResult, params: Params) => { return apiToResult(core, result, params); }, diff --git a/packages/evmApi/src/resolvers/native/getContractEvents.ts b/packages/evmApi/src/resolvers/native/getContractEvents.ts index 8dc1e4c030..e997d8f74e 100644 --- a/packages/evmApi/src/resolvers/native/getContractEvents.ts +++ b/packages/evmApi/src/resolvers/native/getContractEvents.ts @@ -7,7 +7,6 @@ import { } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { EvmChainish, EvmAddress, EvmAddressish, EvmEvent } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -29,7 +28,7 @@ export const getContractEvents = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getContractEvents', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/events`, + getUrl: (params: Params) => `/${params.address}/events`, // TODO: remove PaginatedResponse when api squad make swagger update apiToResult: (data: PaginatedResult, params: Params) => (data.result.result ?? [])?.map((event) => diff --git a/packages/evmApi/src/resolvers/native/getDateToBlock.ts b/packages/evmApi/src/resolvers/native/getDateToBlock.ts index ad8de9f3f5..201981ad39 100644 --- a/packages/evmApi/src/resolvers/native/getDateToBlock.ts +++ b/packages/evmApi/src/resolvers/native/getDateToBlock.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { dateInputToDate } from '@moralisweb3/core'; import { EvmChainish } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -20,7 +19,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getDateToBlock = createEndpointFactory((core) => createEndpoint({ name: 'getDateToBlock', - getUrl: () => `${BASE_URL}/dateToBlock`, + getUrl: () => `/dateToBlock`, apiToResult: (data: ApiResult) => ({ ...data, date: new Date(data.date), diff --git a/packages/evmApi/src/resolvers/native/getLogsByAddress.ts b/packages/evmApi/src/resolvers/native/getLogsByAddress.ts index d3acbf20fc..32727aa994 100644 --- a/packages/evmApi/src/resolvers/native/getLogsByAddress.ts +++ b/packages/evmApi/src/resolvers/native/getLogsByAddress.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmTransactionLog } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -21,7 +20,7 @@ export const getLogsByAddress = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getLogsByAddress', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/logs`, + getUrl: (params: Params) => `/${params.address}/logs`, apiToResult: (data: ApiResult) => (data.result ?? []).map( (log) => diff --git a/packages/evmApi/src/resolvers/native/getNFTTransfersByBlock.ts b/packages/evmApi/src/resolvers/native/getNFTTransfersByBlock.ts index 9f71d76603..ec92ef5b12 100644 --- a/packages/evmApi/src/resolvers/native/getNFTTransfersByBlock.ts +++ b/packages/evmApi/src/resolvers/native/getNFTTransfersByBlock.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddress, EvmNative, EvmNftTransfer } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -20,7 +19,7 @@ export const getNFTTransfersByBlock = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTTransfersByBlock', urlParams: ['blockNumberOrHash'], - getUrl: (params: Params) => `${BASE_URL}/block/${params.blockNumberOrHash}/nft/transfers`, + getUrl: (params: Params) => `/block/${params.blockNumberOrHash}/nft/transfers`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((transfer) => EvmNftTransfer.create({ diff --git a/packages/evmApi/src/resolvers/native/getTransaction.ts b/packages/evmApi/src/resolvers/native/getTransaction.ts index a76bb86aa7..23c9c60eb4 100644 --- a/packages/evmApi/src/resolvers/native/getTransaction.ts +++ b/packages/evmApi/src/resolvers/native/getTransaction.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { EvmChainish, EvmTransaction, EvmTransactionLog } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -21,7 +20,7 @@ export const getTransaction = createEndpointFactory((core) => createEndpoint({ name: 'getTransaction', urlParams: ['transactionHash'], - getUrl: (params: Params) => `${BASE_URL}/transaction/${params.transactionHash}`, + getUrl: (params: Params) => `/transaction/${params.transactionHash}`, apiToResult: (data: ApiResult, params: Params) => { return EvmTransaction.create({ from: data.from_address, diff --git a/packages/evmApi/src/resolvers/native/runContractFunction.ts b/packages/evmApi/src/resolvers/native/runContractFunction.ts index 1dd53ba1b6..3cbd4d7426 100644 --- a/packages/evmApi/src/resolvers/native/runContractFunction.ts +++ b/packages/evmApi/src/resolvers/native/runContractFunction.ts @@ -1,6 +1,5 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { EvmChainish, EvmAddress, EvmAddressish } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -28,7 +27,7 @@ export const runContractFunction = createEndpointFactory((core) => createEndpoint({ name: 'runContractFunction', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/${params.address}/function`, + getUrl: (params: Params) => `/${params.address}/function`, apiToResult: (data: ApiResult) => { return data; }, diff --git a/packages/evmApi/src/resolvers/resolve/resolveAddress.ts b/packages/evmApi/src/resolvers/resolve/resolveAddress.ts index 09b3e34338..0f0eccde55 100644 --- a/packages/evmApi/src/resolvers/resolve/resolveAddress.ts +++ b/packages/evmApi/src/resolvers/resolve/resolveAddress.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { EvmAddress, EvmAddressish } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; type operation = 'resolveAddress'; @@ -19,7 +18,7 @@ export const resolveAddress = createEndpointFactory((core) => createEndpoint({ name: 'resolveAddress', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/resolve/${params.address}/reverse`, + getUrl: (params: Params) => `/resolve/${params.address}/reverse`, apiToResult: (data: ApiResult) => data, resultToJson: (data) => data, parseParams: (params: Params) => ({ diff --git a/packages/evmApi/src/resolvers/resolve/resolveDomain.ts b/packages/evmApi/src/resolvers/resolve/resolveDomain.ts index 0298f36c19..d0ac279ac0 100644 --- a/packages/evmApi/src/resolvers/resolve/resolveDomain.ts +++ b/packages/evmApi/src/resolvers/resolve/resolveDomain.ts @@ -1,6 +1,5 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { EvmAddress } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; type operation = 'resolveDomain'; @@ -15,7 +14,7 @@ export const resolveDomain = createEndpointFactory((core) => createEndpoint({ name: 'resolveDomain', urlParams: ['domain'], - getUrl: (params: ApiParams) => `${BASE_URL}/resolve/${params.domain}`, + getUrl: (params: ApiParams) => `/resolve/${params.domain}`, apiToResult: (data: ApiResult) => ({ address: EvmAddress.create(data.address, core), }), diff --git a/packages/evmApi/src/resolvers/storage/uploadFolder.ts b/packages/evmApi/src/resolvers/storage/uploadFolder.ts index 0bde23ec64..0e10e6e99c 100644 --- a/packages/evmApi/src/resolvers/storage/uploadFolder.ts +++ b/packages/evmApi/src/resolvers/storage/uploadFolder.ts @@ -1,5 +1,4 @@ import { createEndpoint, createEndpointFactory, EndpointBodyType } from '@moralisweb3/api-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; type operation = 'uploadFolder'; @@ -18,7 +17,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const uploadFolder = createEndpointFactory(() => createEndpoint({ name: 'uploadFolder', - getUrl: () => `${BASE_URL}/ipfs/uploadFolder`, + getUrl: () => `/ipfs/uploadFolder`, apiToResult: (data: ApiResult) => { return data; }, diff --git a/packages/evmApi/src/resolvers/token/getAllTokenIds.ts b/packages/evmApi/src/resolvers/token/getAllTokenIds.ts index 811a57ae61..c43c2287e7 100644 --- a/packages/evmApi/src/resolvers/token/getAllTokenIds.ts +++ b/packages/evmApi/src/resolvers/token/getAllTokenIds.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNft } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -21,7 +20,7 @@ export const getAllTokenIds = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getAllTokenIds', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}`, + getUrl: (params: Params) => `/nft/${params.address}`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map( (nft) => diff --git a/packages/evmApi/src/resolvers/token/getContractNFTTransfers.ts b/packages/evmApi/src/resolvers/token/getContractNFTTransfers.ts index 834ca3dd15..b9fb5db125 100644 --- a/packages/evmApi/src/resolvers/token/getContractNFTTransfers.ts +++ b/packages/evmApi/src/resolvers/token/getContractNFTTransfers.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNative, EvmNftTransfer } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -21,7 +20,7 @@ export const getContractNFTTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getContractNFTTransfers', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/transfers`, + getUrl: (params: Params) => `/nft/${params.address}/transfers`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((transfer) => EvmNftTransfer.create({ diff --git a/packages/evmApi/src/resolvers/token/getNFTLowestPrice.ts b/packages/evmApi/src/resolvers/token/getNFTLowestPrice.ts index c236e6cbf7..6a52e908da 100644 --- a/packages/evmApi/src/resolvers/token/getNFTLowestPrice.ts +++ b/packages/evmApi/src/resolvers/token/getNFTLowestPrice.ts @@ -2,7 +2,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNative, EvmNftTrade } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getNFTLowestPrice = createEndpointFactory((core) => createEndpoint({ name: 'getNFTLowestPrice', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/lowestprice`, + getUrl: (params: Params) => `/nft/${params.address}/lowestprice`, apiToResult: (data: ApiResult, params: Params) => EvmNftTrade.create({ ...toCamelCase(data), diff --git a/packages/evmApi/src/resolvers/token/getNFTMetadata.ts b/packages/evmApi/src/resolvers/token/getNFTMetadata.ts index 13f1f17f8a..218ae828b7 100644 --- a/packages/evmApi/src/resolvers/token/getNFTMetadata.ts +++ b/packages/evmApi/src/resolvers/token/getNFTMetadata.ts @@ -8,7 +8,6 @@ import { EvmNftMetadata, validateValidEvmContractType, } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -29,7 +28,7 @@ export const getNFTMetadata = createEndpointFactory((core) => createEndpoint({ name: 'getNFTMetadata', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/metadata`, + getUrl: (params: Params) => `/nft/${params.address}/metadata`, apiToResult: (data: ApiResult, params: Params) => EvmNftMetadata.create({ ...toCamelCase(data), diff --git a/packages/evmApi/src/resolvers/token/getNFTOwners.ts b/packages/evmApi/src/resolvers/token/getNFTOwners.ts index 2c28a708a3..a71a5601ae 100644 --- a/packages/evmApi/src/resolvers/token/getNFTOwners.ts +++ b/packages/evmApi/src/resolvers/token/getNFTOwners.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNft } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getNFTOwners = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTOwners', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/owners`, + getUrl: (params: Params) => `/nft/${params.address}/owners`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((nft) => EvmNft.create({ diff --git a/packages/evmApi/src/resolvers/token/getNFTTrades.ts b/packages/evmApi/src/resolvers/token/getNFTTrades.ts index a91fecd408..5f274c5f1e 100644 --- a/packages/evmApi/src/resolvers/token/getNFTTrades.ts +++ b/packages/evmApi/src/resolvers/token/getNFTTrades.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNative, EvmNftTrade } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -21,7 +20,7 @@ export const getNFTTrades = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTTrades', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/trades`, + getUrl: (params: Params) => `/nft/${params.address}/trades`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((trade) => EvmNftTrade.create({ diff --git a/packages/evmApi/src/resolvers/token/getNftTransfersFromToBlock.ts b/packages/evmApi/src/resolvers/token/getNftTransfersFromToBlock.ts index 7ffcf16913..652f4f4f55 100644 --- a/packages/evmApi/src/resolvers/token/getNftTransfersFromToBlock.ts +++ b/packages/evmApi/src/resolvers/token/getNftTransfersFromToBlock.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddress, EvmNative, EvmNftTransfer } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -18,7 +17,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getNftTransfersFromToBlock = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNftTransfersFromToBlock', - getUrl: () => `${BASE_URL}/nft/transfers`, + getUrl: () => `/nft/transfers`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((transfer) => EvmNftTransfer.create({ diff --git a/packages/evmApi/src/resolvers/token/getTokenAddressTransfers.ts b/packages/evmApi/src/resolvers/token/getTokenAddressTransfers.ts index c332e67880..d37dd8bf62 100644 --- a/packages/evmApi/src/resolvers/token/getTokenAddressTransfers.ts +++ b/packages/evmApi/src/resolvers/token/getTokenAddressTransfers.ts @@ -1,7 +1,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParams } from '@moralisweb3/api-utils'; import { BigNumber, Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, Erc20Transfer } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getTokenAddressTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getTokenAddressTransfers', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/erc20/${params.address}/transfers`, + getUrl: (params: Params) => `/erc20/${params.address}/transfers`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((transfer) => Erc20Transfer.create({ diff --git a/packages/evmApi/src/resolvers/token/getTokenAllowance.ts b/packages/evmApi/src/resolvers/token/getTokenAllowance.ts index b4e70a06d4..56a8d6e334 100644 --- a/packages/evmApi/src/resolvers/token/getTokenAllowance.ts +++ b/packages/evmApi/src/resolvers/token/getTokenAllowance.ts @@ -2,7 +2,6 @@ import { BigNumber, Camelize } from '@moralisweb3/core'; import { EvmAddress, EvmAddressish, EvmChainish } from '@moralisweb3/evm-utils'; import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { operations } from '../../generated/types'; -import { BASE_URL } from '../../EvmApi'; import { EvmChainResolver } from '../EvmChainResolver'; type operation = 'getTokenAllowance'; @@ -24,7 +23,7 @@ export const getTokenAllowance = createEndpointFactory((core) => createEndpoint({ name: 'getTokenAllowance', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/erc20/${params.address}/allowance`, + getUrl: (params: Params) => `/erc20/${params.address}/allowance`, apiToResult: (data: ApiResult) => ({ allowance: BigNumber.create(data.allowance), }), diff --git a/packages/evmApi/src/resolvers/token/getTokenIdMetadata.ts b/packages/evmApi/src/resolvers/token/getTokenIdMetadata.ts index 028e05c792..937feb7178 100644 --- a/packages/evmApi/src/resolvers/token/getTokenIdMetadata.ts +++ b/packages/evmApi/src/resolvers/token/getTokenIdMetadata.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNft } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getTokenIdMetadata = createEndpointFactory((core) => createEndpoint({ name: 'getTokenIdMetadata', urlParams: ['address', 'tokenId'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/${params.tokenId}`, + getUrl: (params: Params) => `/nft/${params.address}/${params.tokenId}`, apiToResult: (data: ApiResult, params: Params) => EvmNft.create({ ...toCamelCase(data), diff --git a/packages/evmApi/src/resolvers/token/getTokenIdOwners.ts b/packages/evmApi/src/resolvers/token/getTokenIdOwners.ts index 6972dc547d..e01e163157 100644 --- a/packages/evmApi/src/resolvers/token/getTokenIdOwners.ts +++ b/packages/evmApi/src/resolvers/token/getTokenIdOwners.ts @@ -2,7 +2,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParam import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNft } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -23,7 +22,7 @@ export const getTokenIdOwners = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getTokenIdOwners', urlParams: ['address', 'tokenId'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/${params.tokenId}/owners`, + getUrl: (params: Params) => `/nft/${params.address}/${params.tokenId}/owners`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((nft) => EvmNft.create({ diff --git a/packages/evmApi/src/resolvers/token/getTokenMetadata.ts b/packages/evmApi/src/resolvers/token/getTokenMetadata.ts index d67079e85d..b5603d39f3 100644 --- a/packages/evmApi/src/resolvers/token/getTokenMetadata.ts +++ b/packages/evmApi/src/resolvers/token/getTokenMetadata.ts @@ -2,7 +2,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { Erc20Token, EvmChainish, EvmAddressish, EvmAddress } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -21,7 +20,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getTokenMetadata = createEndpointFactory((core) => createEndpoint({ name: 'getTokenMetadata', - getUrl: () => `${BASE_URL}/erc20/metadata`, + getUrl: () => `/erc20/metadata`, apiToResult: (data: ApiResult, params: Params) => (data ?? []).map((token) => { return { diff --git a/packages/evmApi/src/resolvers/token/getTokenMetadataBySymbol.ts b/packages/evmApi/src/resolvers/token/getTokenMetadataBySymbol.ts index 9260f1ff89..ec7bc12fe9 100644 --- a/packages/evmApi/src/resolvers/token/getTokenMetadataBySymbol.ts +++ b/packages/evmApi/src/resolvers/token/getTokenMetadataBySymbol.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { Erc20Token, EvmChainish } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -19,7 +18,7 @@ export interface Params extends Camelize> { export const getTokenMetadataBySymbol = createEndpointFactory((core) => createEndpoint({ name: 'getTokenMetadataBySymbol', - getUrl: () => `${BASE_URL}/erc20/metadata/symbols`, + getUrl: () => `/erc20/metadata/symbols`, apiToResult: (data: ApiResult, params: Params) => (data ?? []).map((token) => { return { diff --git a/packages/evmApi/src/resolvers/token/getTokenPrice.ts b/packages/evmApi/src/resolvers/token/getTokenPrice.ts index 7ceb1c48a0..20a2690095 100644 --- a/packages/evmApi/src/resolvers/token/getTokenPrice.ts +++ b/packages/evmApi/src/resolvers/token/getTokenPrice.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmNative, EvmAddress, EvmChainish, EvmAddressish } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getTokenPrice = createEndpointFactory((core) => createEndpoint({ name: 'getTokenPrice', urlParams: ['address'], - getUrl: (params: ApiParams) => `${BASE_URL}/erc20/${params.address}/price`, + getUrl: (params: ApiParams) => `/erc20/${params.address}/price`, apiToResult: (data: ApiResult) => ({ ...toCamelCase(data), nativePrice: data.nativePrice?.value diff --git a/packages/evmApi/src/resolvers/token/getWalletTokenIdTransfers.ts b/packages/evmApi/src/resolvers/token/getWalletTokenIdTransfers.ts index 8cd233e6cd..2376351a7f 100644 --- a/packages/evmApi/src/resolvers/token/getWalletTokenIdTransfers.ts +++ b/packages/evmApi/src/resolvers/token/getWalletTokenIdTransfers.ts @@ -2,7 +2,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParam import { Camelize, toCamelCase } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNative, EvmNftTransfer } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -22,7 +21,7 @@ export const getWalletTokenIdTransfers = createPaginatedEndpointFactory((core) = createPaginatedEndpoint({ name: 'getWalletTokenIdTransfers', urlParams: ['address', 'tokenId'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/${params.tokenId}/transfers`, + getUrl: (params: Params) => `/nft/${params.address}/${params.tokenId}/transfers`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((transfer) => EvmNftTransfer.create({ diff --git a/packages/evmApi/src/resolvers/token/reSyncMetadata.ts b/packages/evmApi/src/resolvers/token/reSyncMetadata.ts index 371846316e..a4e84aaaa3 100644 --- a/packages/evmApi/src/resolvers/token/reSyncMetadata.ts +++ b/packages/evmApi/src/resolvers/token/reSyncMetadata.ts @@ -2,7 +2,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -23,7 +22,7 @@ export const reSyncMetadata = createEndpointFactory((core) => createEndpoint({ name: 'reSyncMetadata', urlParams: ['address', 'tokenId'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/${params.tokenId}/metadata/resync`, + getUrl: (params: Params) => `/nft/${params.address}/${params.tokenId}/metadata/resync`, apiToResult: (data: ApiResult) => ({ ...data, }), diff --git a/packages/evmApi/src/resolvers/token/searchNFTs.ts b/packages/evmApi/src/resolvers/token/searchNFTs.ts index b0b3e3c486..26cb0858b1 100644 --- a/packages/evmApi/src/resolvers/token/searchNFTs.ts +++ b/packages/evmApi/src/resolvers/token/searchNFTs.ts @@ -2,7 +2,6 @@ import { createPaginatedEndpointFactory, createPaginatedEndpoint, PaginatedParam import { Camelize } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress, EvmNft } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -20,7 +19,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const searchNFTs = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'searchNFTs', - getUrl: () => `${BASE_URL}/nft/search`, + getUrl: () => `/nft/search`, apiToResult: (data: ApiResult, params: Params) => (data.result ?? []).map((nft) => ({ token: new EvmNft({ diff --git a/packages/evmApi/src/resolvers/token/syncNFTContract.ts b/packages/evmApi/src/resolvers/token/syncNFTContract.ts index f9fec3aef7..3301ec4675 100644 --- a/packages/evmApi/src/resolvers/token/syncNFTContract.ts +++ b/packages/evmApi/src/resolvers/token/syncNFTContract.ts @@ -1,7 +1,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { EvmChainish, EvmAddressish, EvmAddress } from '@moralisweb3/evm-utils'; -import { BASE_URL } from '../../EvmApi'; import { operations } from '../../generated/types'; import { EvmChainResolver } from '../EvmChainResolver'; @@ -24,7 +23,7 @@ export const syncNFTContract = createEndpointFactory((core) => createEndpoint({ name: 'syncNFTContract', urlParams: ['address'], - getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/sync`, + getUrl: (params: Params) => `/nft/${params.address}/sync`, apiToResult: (_: ApiResult) => ({ success: true, }), diff --git a/packages/solApi/src/MoralisSolApi.ts b/packages/solApi/src/MoralisSolApi.ts index d5d5647b97..80267ee757 100644 --- a/packages/solApi/src/MoralisSolApi.ts +++ b/packages/solApi/src/MoralisSolApi.ts @@ -7,7 +7,7 @@ import { getPortfolio } from './resolvers/account/getPortfolio'; import { getSPL } from './resolvers/account/getSPL'; import { getNFTMetadata } from './resolvers/nft/getNFTMetadata'; -export const BASE_URL = 'https://solana-gateway.moralis.io'; +const BASE_URL = 'https://solana-gateway.moralis.io'; export class MoralisSolApi extends ApiModule { public static readonly moduleName = 'solApi'; diff --git a/packages/solApi/src/resolvers/account/getBalance.ts b/packages/solApi/src/resolvers/account/getBalance.ts index b908ddbc43..aaa60f6a81 100644 --- a/packages/solApi/src/resolvers/account/getBalance.ts +++ b/packages/solApi/src/resolvers/account/getBalance.ts @@ -2,7 +2,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { SolAddress, SolAddressish, SolNetworkish, SolNative } from '@moralisweb3/sol-utils'; import { operations } from '../../generated/types'; -import { BASE_URL } from '../../MoralisSolApi'; import { SolNetworkResolver } from '../SolNetworkResolver'; type Operation = 'balance'; @@ -26,7 +25,7 @@ export const getBalance = createEndpointFactory((core) => // but it's not working with Endpoints.getDescriptors(). After changes described in Endpoints // please replace this line. const network = params.network ? params.network : SolNetworkResolver.resolve(undefined, core); - return `${BASE_URL}/account/${network}/${params.address}/balance`; + return `/account/${network}/${params.address}/balance`; }, apiToResult: (data: ApiResult) => { return SolNative.create(data.lamports, 'lamports'); diff --git a/packages/solApi/src/resolvers/account/getNFTs.ts b/packages/solApi/src/resolvers/account/getNFTs.ts index 8f0d54c5a9..6fdd229928 100644 --- a/packages/solApi/src/resolvers/account/getNFTs.ts +++ b/packages/solApi/src/resolvers/account/getNFTs.ts @@ -2,7 +2,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { SolAddress, SolAddressish, SolNetworkish } from '@moralisweb3/sol-utils'; import { operations } from '../../generated/types'; -import { BASE_URL } from '../../MoralisSolApi'; import { SolNetworkResolver } from '../SolNetworkResolver'; type Operation = 'getNFTs'; @@ -26,7 +25,7 @@ export const getNFTs = createEndpointFactory((core) => // but it's not working with Endpoints.getDescriptors(). After changes described in Endpoints // please replace this line. const network = params.network ? params.network : SolNetworkResolver.resolve(undefined, core); - return `${BASE_URL}/account/${network}/${params.address}/nft`; + return `/account/${network}/${params.address}/nft`; }, apiToResult: (data: ApiResult) => { return data.map((nft) => { diff --git a/packages/solApi/src/resolvers/account/getPortfolio.ts b/packages/solApi/src/resolvers/account/getPortfolio.ts index b0c75146cc..07da84b875 100644 --- a/packages/solApi/src/resolvers/account/getPortfolio.ts +++ b/packages/solApi/src/resolvers/account/getPortfolio.ts @@ -2,7 +2,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { SolAddress, SolAddressish, SolNative, SolNetworkish } from '@moralisweb3/sol-utils'; import { operations } from '../../generated/types'; -import { BASE_URL } from '../../MoralisSolApi'; import { SolNetworkResolver } from '../SolNetworkResolver'; type Operation = 'getPortfolio'; @@ -26,7 +25,7 @@ export const getPortfolio = createEndpointFactory((core) => // but it's not working with Endpoints.getDescriptors(). After changes described in Endpoints // please replace this line. const network = params.network ? params.network : SolNetworkResolver.resolve(undefined, core); - return `${BASE_URL}/account/${network}/${params.address}/portfolio`; + return `/account/${network}/${params.address}/portfolio`; }, apiToResult: (data: ApiResult) => { return { diff --git a/packages/solApi/src/resolvers/account/getSPL.ts b/packages/solApi/src/resolvers/account/getSPL.ts index edb2f878dd..6f7ab85a42 100644 --- a/packages/solApi/src/resolvers/account/getSPL.ts +++ b/packages/solApi/src/resolvers/account/getSPL.ts @@ -2,7 +2,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { SolAddress, SolAddressish, SolNative, SolNetworkish } from '@moralisweb3/sol-utils'; import { operations } from '../../generated/types'; -import { BASE_URL } from '../../MoralisSolApi'; import { SolNetworkResolver } from '../SolNetworkResolver'; type Operation = 'getSPL'; @@ -26,7 +25,7 @@ export const getSPL = createEndpointFactory((core) => // but it's not working with Endpoints.getDescriptors(). After changes described in Endpoints // please replace this line. const network = params.network ? params.network : SolNetworkResolver.resolve(undefined, core); - return `${BASE_URL}/account/${network}/${params.address}/tokens`; + return `/account/${network}/${params.address}/tokens`; }, apiToResult: (data: ApiResult) => { return data.map((token) => { diff --git a/packages/solApi/src/resolvers/nft/getNFTMetadata.ts b/packages/solApi/src/resolvers/nft/getNFTMetadata.ts index 76f600f1f9..7c778db5b4 100644 --- a/packages/solApi/src/resolvers/nft/getNFTMetadata.ts +++ b/packages/solApi/src/resolvers/nft/getNFTMetadata.ts @@ -2,7 +2,6 @@ import { createEndpoint, createEndpointFactory } from '@moralisweb3/api-utils'; import { Camelize } from '@moralisweb3/core'; import { SolAddress, SolAddressish, SolNetworkish } from '@moralisweb3/sol-utils'; import { operations } from '../../generated/types'; -import { BASE_URL } from '../../MoralisSolApi'; import { SolNetworkResolver } from '../SolNetworkResolver'; type Operation = 'getNFTMetadata'; @@ -26,7 +25,7 @@ export const getNFTMetadata = createEndpointFactory((core) => // but it's not working with Endpoints.getDescriptors(). After changes described in Endpoints // please replace this line. const network = params.network ? params.network : SolNetworkResolver.resolve(undefined, core); - return `${BASE_URL}/nft/${network}/${params.address}/metadata`; + return `/nft/${network}/${params.address}/metadata`; }, apiToResult: (data: ApiResult) => { return {