diff --git a/.changeset/chilly-chefs-sort.md b/.changeset/chilly-chefs-sort.md new file mode 100644 index 0000000000..6c37ab968b --- /dev/null +++ b/.changeset/chilly-chefs-sort.md @@ -0,0 +1,7 @@ +--- +'@moralisweb3/api-utils': patch +'@moralisweb3/evm-api': patch +'@moralisweb3/sol-api': patch +--- + +Deleted redundant search parameters in API URLs. diff --git a/packages/apiUtils/src/resolvers/Endpoint.ts b/packages/apiUtils/src/resolvers/Endpoint.ts index 3f029b0967..07cb8e400c 100644 --- a/packages/apiUtils/src/resolvers/Endpoint.ts +++ b/packages/apiUtils/src/resolvers/Endpoint.ts @@ -13,6 +13,7 @@ export interface Endpoint JSONResult; parseParams: (params: Params) => ApiParams; method?: EndpointMethod; + urlParams?: readonly (keyof Params)[]; bodyParams?: readonly (keyof Params)[]; bodyType?: EndpointBodyType; name: string; diff --git a/packages/apiUtils/src/resolvers/EndpointParamsReader.ts b/packages/apiUtils/src/resolvers/EndpointParamsReader.ts index 8d05446dba..be06a98cfc 100644 --- a/packages/apiUtils/src/resolvers/EndpointParamsReader.ts +++ b/packages/apiUtils/src/resolvers/EndpointParamsReader.ts @@ -3,26 +3,29 @@ import { Endpoint, EndpointBodyType } from './Endpoint'; export class EndpointParamsReader { public constructor(private readonly endpoint: Endpoint) {} - protected isBodyParam = (param: string) => { + private isBodyParam(param: string): boolean { if (this.endpoint.method === 'get') { return false; } if (!this.endpoint.bodyParams || this.endpoint.bodyParams.length === 0) { return false; } - // @ts-ignore TODO: fix the param string cast from keyof - return this.endpoint.bodyParams.includes(param); - }; + return this.endpoint.bodyParams.includes(param as keyof Params); + } + + private isUrlParam(param: string): boolean { + return !!this.endpoint.urlParams && this.endpoint.urlParams.includes(param as keyof Params); + } public getSearchParams(params: ApiParams) { return Object.keys(params).reduce((result, key) => { - // @ts-ignore TODO: fix the ApiParams type, as it should extend object/record - if (!params[key] || this.isBodyParam(key)) { + const paramKey = key as keyof ApiParams; + + if (!params[paramKey] || this.isBodyParam(key) || this.isUrlParam(key)) { return result; } - // @ts-ignore TODO: fix the ApiParams type, as it should extend object/record - return { ...result, [key]: params[key] }; + return { ...result, [key]: params[paramKey] }; }, {}); } @@ -36,8 +39,7 @@ export class EndpointParamsReader { data: eventRawResult, }); } else { - return Promise.reject('Invalid url'); + return Promise.reject(`Invalid url: ${options.url}`); } }); }); diff --git a/packages/core/src/controllers/RequestController.ts b/packages/core/src/controllers/RequestController.ts index 239dc1eb04..f85aa30280 100644 --- a/packages/core/src/controllers/RequestController.ts +++ b/packages/core/src/controllers/RequestController.ts @@ -21,7 +21,7 @@ export class RequestController { private constructor(private readonly logger: LoggerController) {} - public async request(config: AxiosRequestConfig): Promise { + private async request(config: AxiosRequestConfig): Promise { this.logger.verbose('[RequestController] request started', { url: config.url, method: config.method, @@ -72,7 +72,7 @@ export class RequestController { } } - public makeError(error: unknown): MoralisCoreError { + private makeError(error: unknown): MoralisCoreError { if (axios.isAxiosError(error)) { const axiosError = error as AxiosError; return new MoralisCoreError({ @@ -95,50 +95,50 @@ export class RequestController { }); } - public post, Body extends Record>( + public post, Body extends Record>( url: string, - params?: Params, + searchParams?: SearchParams, body?: Body, options?: RequestOptions, abortSignal?: AbortController['signal'], ): Promise { return this.request({ url, + params: searchParams, method: 'POST', data: body, - params, headers: options?.headers, signal: abortSignal, }); } - public put, Body extends Record>( + public put, Body extends Record>( url: string, - params?: Params, + searchParams?: SearchParams, body?: Body, options?: RequestOptions, abortSignal?: AbortController['signal'], ): Promise { return this.request({ url, + params: searchParams, method: 'PUT', data: body, - params, headers: options?.headers, signal: abortSignal, }); } - public async get>( + public async get>( url: string, - params?: Params, + searchParams?: SearchParams, options?: RequestOptions, abortSignal?: AbortController['signal'], ): Promise { return this.request({ url, + params: searchParams, method: 'GET', - params, headers: options?.headers, signal: abortSignal, }); diff --git a/packages/evmApi/src/resolvers/account/getNFTTransfers.ts b/packages/evmApi/src/resolvers/account/getNFTTransfers.ts index 23ca881249..bc271fc745 100644 --- a/packages/evmApi/src/resolvers/account/getNFTTransfers.ts +++ b/packages/evmApi/src/resolvers/account/getNFTTransfers.ts @@ -20,6 +20,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getNFTTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTTransfers', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/${params.address}/nft/transfers`, apiToResult: (data: ApiResult) => data.result?.map((transfer) => ({ diff --git a/packages/evmApi/src/resolvers/account/getNFTs.ts b/packages/evmApi/src/resolvers/account/getNFTs.ts index 8cb08b73eb..314053280d 100644 --- a/packages/evmApi/src/resolvers/account/getNFTs.ts +++ b/packages/evmApi/src/resolvers/account/getNFTs.ts @@ -22,6 +22,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getNFTs = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTs', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/${params.address}/nft`, apiToResult: (data: ApiResult, params: Params) => data.result?.map((nft) => ({ diff --git a/packages/evmApi/src/resolvers/account/getNFTsForContract.ts b/packages/evmApi/src/resolvers/account/getNFTsForContract.ts index 231c5a12f4..472f78d116 100644 --- a/packages/evmApi/src/resolvers/account/getNFTsForContract.ts +++ b/packages/evmApi/src/resolvers/account/getNFTsForContract.ts @@ -22,6 +22,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getNFTsForContract = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTsForContract', + urlParams: ['address', 'tokenAddress'], getUrl: (params: Params) => `${BASE_URL}/${params.address}/nft/${params.tokenAddress}`, apiToResult: (data: ApiResult, params: Params) => data.result?.map((nft) => ({ diff --git a/packages/evmApi/src/resolvers/account/getNativeBalance.ts b/packages/evmApi/src/resolvers/account/getNativeBalance.ts index aca8fedc80..3c96e7e3e1 100644 --- a/packages/evmApi/src/resolvers/account/getNativeBalance.ts +++ b/packages/evmApi/src/resolvers/account/getNativeBalance.ts @@ -21,6 +21,7 @@ export interface Params extends Camelize> { export const getNativeBalance = createEndpointFactory((core) => createEndpoint({ name: 'getNativeBalance', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/${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 b9e7e5e699..d98c6e1a50 100644 --- a/packages/evmApi/src/resolvers/account/getTokenBalances.ts +++ b/packages/evmApi/src/resolvers/account/getTokenBalances.ts @@ -21,6 +21,7 @@ export interface Params extends Camelize> { export const getTokenBalances = createEndpointFactory((core) => createEndpoint({ name: 'getTokenBalances', + urlParams: ['address'], getUrl: (params: ApiParams) => `${BASE_URL}/${params.address}/erc20`, apiToResult: (data: ApiResult, params: ApiParams) => data.map((token) => ({ diff --git a/packages/evmApi/src/resolvers/account/getTokenTransfers.ts b/packages/evmApi/src/resolvers/account/getTokenTransfers.ts index 723b1c3c4f..00950357e7 100644 --- a/packages/evmApi/src/resolvers/account/getTokenTransfers.ts +++ b/packages/evmApi/src/resolvers/account/getTokenTransfers.ts @@ -20,6 +20,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getTokenTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getTokenTransfers', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/${params.address}/erc20/transfers`, apiToResult: (data: ApiResult) => data.result?.map((transfer) => ({ diff --git a/packages/evmApi/src/resolvers/account/getTransactions.ts b/packages/evmApi/src/resolvers/account/getTransactions.ts index 6099be72f7..22e500cbf9 100644 --- a/packages/evmApi/src/resolvers/account/getTransactions.ts +++ b/packages/evmApi/src/resolvers/account/getTransactions.ts @@ -20,6 +20,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getTransactions = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getTransactions', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/${params.address}`, apiToResult: (data: ApiResult, params: Params) => data.result?.map((transaction) => diff --git a/packages/evmApi/src/resolvers/defi/getPairAddress.ts b/packages/evmApi/src/resolvers/defi/getPairAddress.ts index 49ff1998af..caca601c74 100644 --- a/packages/evmApi/src/resolvers/defi/getPairAddress.ts +++ b/packages/evmApi/src/resolvers/defi/getPairAddress.ts @@ -22,6 +22,7 @@ export interface Params extends Camelize createEndpoint({ name: 'getPairAddress', + urlParams: ['token0Address', 'token1Address'], getUrl: (params: Params) => `${BASE_URL}/${params.token0Address}/${params.token1Address}/pairAddress`, apiToResult: (data: ApiResult, params: Params) => ({ // ApiResult types generated all come as undefined which should not be the case TODO: diff --git a/packages/evmApi/src/resolvers/defi/getPairReserves.ts b/packages/evmApi/src/resolvers/defi/getPairReserves.ts index d67761f63c..3fe1202606 100644 --- a/packages/evmApi/src/resolvers/defi/getPairReserves.ts +++ b/packages/evmApi/src/resolvers/defi/getPairReserves.ts @@ -26,6 +26,7 @@ type ApiResult = { export const getPairReserves = createEndpointFactory((core) => createEndpoint({ name: 'getPairReserves', + urlParams: ['pairAddress'], getUrl: (params: Params) => `${BASE_URL}/${params.pairAddress}/reserves`, apiToResult: (data: ApiResult) => data, resultToJson: (data) => data, diff --git a/packages/evmApi/src/resolvers/native/getBlock.ts b/packages/evmApi/src/resolvers/native/getBlock.ts index 73607e85aa..122a4f6cb1 100644 --- a/packages/evmApi/src/resolvers/native/getBlock.ts +++ b/packages/evmApi/src/resolvers/native/getBlock.ts @@ -75,6 +75,7 @@ const apiToResult = (core: MoralisCore, apiData: ApiResult, params: Params) => { export const getBlock = createEndpointFactory((core) => createEndpoint({ name: 'getBlock', + urlParams: ['blockNumberOrHash'], getUrl: (params: Params) => `${BASE_URL}/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 8f3226bf2d..e0f2a80543 100644 --- a/packages/evmApi/src/resolvers/native/getContractEvents.ts +++ b/packages/evmApi/src/resolvers/native/getContractEvents.ts @@ -28,6 +28,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getContractEvents = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getContractEvents', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/${params.address}/events`, // TODO: remove PaginatedResponse when api squad make swagger update apiToResult: (data: PaginatedResult) => diff --git a/packages/evmApi/src/resolvers/native/getLogsByAddress.ts b/packages/evmApi/src/resolvers/native/getLogsByAddress.ts index 6636eafec4..122740fc0d 100644 --- a/packages/evmApi/src/resolvers/native/getLogsByAddress.ts +++ b/packages/evmApi/src/resolvers/native/getLogsByAddress.ts @@ -20,6 +20,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getLogsByAddress = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getLogsByAddress', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/${params.address}/logs`, apiToResult: (data: ApiResult) => data.result?.map( diff --git a/packages/evmApi/src/resolvers/native/getNFTTransfersByBlock.ts b/packages/evmApi/src/resolvers/native/getNFTTransfersByBlock.ts index f43d116223..c3f8c36be7 100644 --- a/packages/evmApi/src/resolvers/native/getNFTTransfersByBlock.ts +++ b/packages/evmApi/src/resolvers/native/getNFTTransfersByBlock.ts @@ -19,6 +19,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getNFTTransfersByBlock = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTTransfersByBlock', + urlParams: ['blockNumberOrHash'], getUrl: (params: Params) => `${BASE_URL}/block/${params.blockNumberOrHash}/nft/transfers`, apiToResult: (data: ApiResult, params: Params) => data.result?.map((transfer) => ({ diff --git a/packages/evmApi/src/resolvers/native/getTransaction.ts b/packages/evmApi/src/resolvers/native/getTransaction.ts index 99ea99a9ca..aa75ea62a0 100644 --- a/packages/evmApi/src/resolvers/native/getTransaction.ts +++ b/packages/evmApi/src/resolvers/native/getTransaction.ts @@ -20,6 +20,7 @@ export interface Params extends Camelize> { export const getTransaction = createEndpointFactory((core) => createEndpoint({ name: 'getTransaction', + urlParams: ['transactionHash'], getUrl: (params: Params) => `${BASE_URL}/transaction/${params.transactionHash}`, apiToResult: (data: ApiResult, params: Params) => { const transactionReciept = EvmTransactionReceipt.create( diff --git a/packages/evmApi/src/resolvers/native/runContractFunction.ts b/packages/evmApi/src/resolvers/native/runContractFunction.ts index 356aa06abb..1dd53ba1b6 100644 --- a/packages/evmApi/src/resolvers/native/runContractFunction.ts +++ b/packages/evmApi/src/resolvers/native/runContractFunction.ts @@ -27,6 +27,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const runContractFunction = createEndpointFactory((core) => createEndpoint({ name: 'runContractFunction', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/${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 fced820cf9..09b3e34338 100644 --- a/packages/evmApi/src/resolvers/resolve/resolveAddress.ts +++ b/packages/evmApi/src/resolvers/resolve/resolveAddress.ts @@ -18,6 +18,7 @@ export interface Params extends Camelize> { export const resolveAddress = createEndpointFactory((core) => createEndpoint({ name: 'resolveAddress', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/resolve/${params.address}/reverse`, apiToResult: (data: ApiResult) => data, resultToJson: (data) => data, diff --git a/packages/evmApi/src/resolvers/resolve/resolveDomain.ts b/packages/evmApi/src/resolvers/resolve/resolveDomain.ts index 8bed0c3fa0..0298f36c19 100644 --- a/packages/evmApi/src/resolvers/resolve/resolveDomain.ts +++ b/packages/evmApi/src/resolvers/resolve/resolveDomain.ts @@ -14,6 +14,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const resolveDomain = createEndpointFactory((core) => createEndpoint({ name: 'resolveDomain', + urlParams: ['domain'], getUrl: (params: ApiParams) => `${BASE_URL}/resolve/${params.domain}`, apiToResult: (data: ApiResult) => ({ address: EvmAddress.create(data.address, core), diff --git a/packages/evmApi/src/resolvers/token/getAllTokenIds.ts b/packages/evmApi/src/resolvers/token/getAllTokenIds.ts index 7767293a6b..65fedbbf93 100644 --- a/packages/evmApi/src/resolvers/token/getAllTokenIds.ts +++ b/packages/evmApi/src/resolvers/token/getAllTokenIds.ts @@ -40,6 +40,7 @@ interface ApiResult extends Omit { export const getAllTokenIds = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getAllTokenIds', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/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 0ceae99d17..4373445548 100644 --- a/packages/evmApi/src/resolvers/token/getContractNFTTransfers.ts +++ b/packages/evmApi/src/resolvers/token/getContractNFTTransfers.ts @@ -21,6 +21,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getContractNFTTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getContractNFTTransfers', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/transfers`, apiToResult: (data: ApiResult) => data.result?.map((transfer) => ({ diff --git a/packages/evmApi/src/resolvers/token/getNFTLowestPrice.ts b/packages/evmApi/src/resolvers/token/getNFTLowestPrice.ts index d4b2279eef..81ac2d504a 100644 --- a/packages/evmApi/src/resolvers/token/getNFTLowestPrice.ts +++ b/packages/evmApi/src/resolvers/token/getNFTLowestPrice.ts @@ -21,6 +21,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getNFTLowestPrice = createEndpointFactory((core) => createEndpoint({ name: 'getNFTLowestPrice', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/lowestprice`, apiToResult: (data: ApiResult) => ({ ...toCamelCase(data), diff --git a/packages/evmApi/src/resolvers/token/getNFTMetadata.ts b/packages/evmApi/src/resolvers/token/getNFTMetadata.ts index b8fcf166f0..c605a3fe93 100644 --- a/packages/evmApi/src/resolvers/token/getNFTMetadata.ts +++ b/packages/evmApi/src/resolvers/token/getNFTMetadata.ts @@ -20,6 +20,7 @@ export interface Params { export const getNFTMetadata = createEndpointFactory((core) => createEndpoint({ name: 'getNFTMetadata', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/metadata`, apiToResult: (data: ApiResult) => ({ ...toCamelCase(data), diff --git a/packages/evmApi/src/resolvers/token/getNFTOwners.ts b/packages/evmApi/src/resolvers/token/getNFTOwners.ts index 3f200861f8..6dc0ecde99 100644 --- a/packages/evmApi/src/resolvers/token/getNFTOwners.ts +++ b/packages/evmApi/src/resolvers/token/getNFTOwners.ts @@ -21,6 +21,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getNFTOwners = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTOwners', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/owners`, apiToResult: (data: ApiResult, params: Params) => data.result?.map((nft) => ({ diff --git a/packages/evmApi/src/resolvers/token/getNFTTrades.ts b/packages/evmApi/src/resolvers/token/getNFTTrades.ts index 5359cca627..928746f922 100644 --- a/packages/evmApi/src/resolvers/token/getNFTTrades.ts +++ b/packages/evmApi/src/resolvers/token/getNFTTrades.ts @@ -20,6 +20,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getNFTTrades = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getNFTTrades', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/trades`, apiToResult: (data: ApiResult) => data.result?.map((trade) => ({ diff --git a/packages/evmApi/src/resolvers/token/getTokenAddressTransfers.ts b/packages/evmApi/src/resolvers/token/getTokenAddressTransfers.ts index 144106ebbd..7428f716bc 100644 --- a/packages/evmApi/src/resolvers/token/getTokenAddressTransfers.ts +++ b/packages/evmApi/src/resolvers/token/getTokenAddressTransfers.ts @@ -20,6 +20,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getTokenAddressTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getTokenAddressTransfers', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/erc20/${params.address}/transfers`, apiToResult: (data: ApiResult) => data.result?.map((transfer) => ({ diff --git a/packages/evmApi/src/resolvers/token/getTokenAllowance.ts b/packages/evmApi/src/resolvers/token/getTokenAllowance.ts index 076260763a..b4e70a06d4 100644 --- a/packages/evmApi/src/resolvers/token/getTokenAllowance.ts +++ b/packages/evmApi/src/resolvers/token/getTokenAllowance.ts @@ -23,6 +23,7 @@ export interface Params extends Camelize createEndpoint({ name: 'getTokenAllowance', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/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 1d6281725d..8ecacb7a49 100644 --- a/packages/evmApi/src/resolvers/token/getTokenIdMetadata.ts +++ b/packages/evmApi/src/resolvers/token/getTokenIdMetadata.ts @@ -29,6 +29,7 @@ export interface ApiResult extends GeneratedApiResult { export const getTokenIdMetadata = createEndpointFactory((core) => createEndpoint({ name: 'getTokenIdMetadata', + urlParams: ['address', 'tokenId'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/${params.tokenId}`, apiToResult: (data: ApiResult, params: Params) => ({ token: new EvmNFT({ diff --git a/packages/evmApi/src/resolvers/token/getTokenIdOwners.ts b/packages/evmApi/src/resolvers/token/getTokenIdOwners.ts index 9cf10d90f4..54d0e1f709 100644 --- a/packages/evmApi/src/resolvers/token/getTokenIdOwners.ts +++ b/packages/evmApi/src/resolvers/token/getTokenIdOwners.ts @@ -22,6 +22,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getTokenIdOwners = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getTokenIdOwners', + urlParams: ['address', 'tokenId'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/${params.tokenId}/owners`, apiToResult: (data: ApiResult, params: Params) => data.result?.map((nft) => ({ diff --git a/packages/evmApi/src/resolvers/token/getTokenPrice.ts b/packages/evmApi/src/resolvers/token/getTokenPrice.ts index 40d4d24822..7ceb1c48a0 100644 --- a/packages/evmApi/src/resolvers/token/getTokenPrice.ts +++ b/packages/evmApi/src/resolvers/token/getTokenPrice.ts @@ -21,6 +21,7 @@ interface Params extends Camelize> { export const getTokenPrice = createEndpointFactory((core) => createEndpoint({ name: 'getTokenPrice', + urlParams: ['address'], getUrl: (params: ApiParams) => `${BASE_URL}/erc20/${params.address}/price`, apiToResult: (data: ApiResult) => ({ ...toCamelCase(data), diff --git a/packages/evmApi/src/resolvers/token/getWalletTokenIdTransfers.ts b/packages/evmApi/src/resolvers/token/getWalletTokenIdTransfers.ts index cd5dc23112..18deb79568 100644 --- a/packages/evmApi/src/resolvers/token/getWalletTokenIdTransfers.ts +++ b/packages/evmApi/src/resolvers/token/getWalletTokenIdTransfers.ts @@ -21,6 +21,7 @@ type ApiResult = operations[operation]['responses']['200']['content']['applicati export const getWalletTokenIdTransfers = createPaginatedEndpointFactory((core) => createPaginatedEndpoint({ name: 'getWalletTokenIdTransfers', + urlParams: ['address', 'tokenId'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/${params.tokenId}/transfers`, apiToResult: (data: ApiResult) => data.result?.map((transfer) => ({ diff --git a/packages/evmApi/src/resolvers/token/reSyncMetadata.ts b/packages/evmApi/src/resolvers/token/reSyncMetadata.ts index ad7d803d03..371846316e 100644 --- a/packages/evmApi/src/resolvers/token/reSyncMetadata.ts +++ b/packages/evmApi/src/resolvers/token/reSyncMetadata.ts @@ -22,6 +22,7 @@ export interface Params extends Camelize> { export const reSyncMetadata = createEndpointFactory((core) => createEndpoint({ name: 'reSyncMetadata', + urlParams: ['address', 'tokenId'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/${params.tokenId}/metadata/resync`, apiToResult: (data: ApiResult) => ({ ...data, diff --git a/packages/evmApi/src/resolvers/token/syncNFTContract.ts b/packages/evmApi/src/resolvers/token/syncNFTContract.ts index f6ce98e3a4..00473e7f19 100644 --- a/packages/evmApi/src/resolvers/token/syncNFTContract.ts +++ b/packages/evmApi/src/resolvers/token/syncNFTContract.ts @@ -23,6 +23,7 @@ export interface Params extends Camelize> { export const syncNFTContract = createEndpointFactory((core) => createEndpoint({ name: 'syncNFTContract', + urlParams: ['address'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.address}/sync`, apiToResult: (data: ApiResult) => ({ success: true, diff --git a/packages/solApi/src/resolvers/account/getBalance.ts b/packages/solApi/src/resolvers/account/getBalance.ts index 3068404887..58d273e594 100644 --- a/packages/solApi/src/resolvers/account/getBalance.ts +++ b/packages/solApi/src/resolvers/account/getBalance.ts @@ -20,6 +20,7 @@ export interface Params extends Camelize> export const getBalance = createEndpointFactory((core) => createEndpoint({ name: 'getBalance', + urlParams: ['network', 'address'], getUrl: (params: Params) => { const network = SolNetworkResolver.resolve(params.network, core); return `${BASE_URL}/account/${network}/${params.address}/balance`; diff --git a/packages/solApi/src/resolvers/account/getNFTs.ts b/packages/solApi/src/resolvers/account/getNFTs.ts index e46fea833e..cf1fba28eb 100644 --- a/packages/solApi/src/resolvers/account/getNFTs.ts +++ b/packages/solApi/src/resolvers/account/getNFTs.ts @@ -20,6 +20,7 @@ export interface Params extends Camelize> export const getNFTs = createEndpointFactory((core) => createEndpoint({ name: 'getNFTs', + urlParams: ['network', 'address'], getUrl: (params: Params) => { const network = SolNetworkResolver.resolve(params.network, core); return `${BASE_URL}/account/${network}/${params.address}/nft`; diff --git a/packages/solApi/src/resolvers/account/getPortfolio.ts b/packages/solApi/src/resolvers/account/getPortfolio.ts index ac4cdf9c6f..0bfb38e7fb 100644 --- a/packages/solApi/src/resolvers/account/getPortfolio.ts +++ b/packages/solApi/src/resolvers/account/getPortfolio.ts @@ -20,6 +20,7 @@ export interface Params extends Camelize> export const getPortfolio = createEndpointFactory((core) => createEndpoint({ name: 'getPortfolio', + urlParams: ['network', 'address'], getUrl: (params: Params) => { const network = SolNetworkResolver.resolve(params.network, core); return `${BASE_URL}/account/${network}/${params.address}/portfolio`; diff --git a/packages/solApi/src/resolvers/account/getSPL.ts b/packages/solApi/src/resolvers/account/getSPL.ts index 8b106a6a88..407b342603 100644 --- a/packages/solApi/src/resolvers/account/getSPL.ts +++ b/packages/solApi/src/resolvers/account/getSPL.ts @@ -20,6 +20,7 @@ export interface Params extends Camelize> export const getSPL = createEndpointFactory((core) => createEndpoint({ name: 'getSPL', + urlParams: ['network', 'address'], getUrl: (params: Params) => { const network = SolNetworkResolver.resolve(params.network, core); return `${BASE_URL}/account/${network}/${params.address}/tokens`; diff --git a/packages/solApi/src/resolvers/nft/getNFTMetadata.ts b/packages/solApi/src/resolvers/nft/getNFTMetadata.ts index 6b457ef66a..22ed5322cc 100644 --- a/packages/solApi/src/resolvers/nft/getNFTMetadata.ts +++ b/packages/solApi/src/resolvers/nft/getNFTMetadata.ts @@ -20,6 +20,7 @@ export interface Params extends Camelize> export const getNFTMetadata = createEndpointFactory((core) => createEndpoint({ name: 'getNFTMetadata', + urlParams: ['network', 'address'], getUrl: (params: Params) => `${BASE_URL}/nft/${params.network}/${params.address}/metadata`, apiToResult: (data: ApiResult) => { return {