From ba555556452896fbb9af9bc0b8d11fae952a4edb Mon Sep 17 00:00:00 2001 From: SIDANWhatever Date: Mon, 12 Feb 2024 20:17:16 +0800 Subject: [PATCH] feat: fixing lints & issue 12 --- .eslintrc | 2 +- package.json | 2 +- src/api/accounts/helpers.ts | 575 +++++-------- src/api/addresses/helpers.ts | 942 +++++++++------------ src/api/assets/helpers.ts | 1110 ++++++++++--------------- src/api/blocks/helpers.ts | 96 +-- src/api/datum/helpers.ts | 159 ++-- src/api/ecosystem/helpers.ts | 96 +-- src/api/epochs/helpers.ts | 155 ++-- src/api/general/helpers.ts | 310 +++---- src/api/pools/helpers.ts | 741 +++++++---------- src/api/scripts/helpers.ts | 96 +-- src/api/transactionManager/helpers.ts | 357 ++++---- src/api/transactions/helpers.ts | 452 ++++------ src/api/type.ts | 1 + src/api/vesting/helpers.ts | 322 +++---- src/base.ts | 4 +- src/common.ts | 28 +- src/configuration.ts | 1 + 19 files changed, 2198 insertions(+), 3251 deletions(-) diff --git a/.eslintrc b/.eslintrc index 8201bca..85bec66 100644 --- a/.eslintrc +++ b/.eslintrc @@ -29,7 +29,7 @@ "prefer-regex-literals": "warn", "no-control-regex": "warn", "no-use-before-define": "warn", - "no-param-reassign": "warn", + "no-param-reassign": "off", "max-classes-per-file": "warn", "no-useless-constructor": "off" }, diff --git a/package.json b/package.json index 1a7a0cc..ae48009 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@maestro-org/typescript-sdk", - "version": "1.4.2", + "version": "2.0.0", "description": "TypeScript SDK for the Maestro Dapp Platform", "main": "dist/index.js", "module": "dist/index.mjs", diff --git a/src/api/accounts/helpers.ts b/src/api/accounts/helpers.ts index c484cc1..3397c89 100644 --- a/src/api/accounts/helpers.ts +++ b/src/api/accounts/helpers.ts @@ -30,382 +30,263 @@ import { * AccountsApi - axios parameter creator * @export */ -export const AccountsApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns a list of addresses seen on-chain which use the specified stake key - * @summary Stake account addresses - * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {AccountAddressesQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountAddresses: async ( - stakeAddr: string, - localVarQueryParameter: AccountAddressesQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'stakeAddr' is not null or undefined - assertParamExists('accountAddresses', 'stakeAddr', stakeAddr); - const localVarPath = `/accounts/{stake_addr}/addresses`.replace( - `{${'stake_addr'}}`, - encodeURIComponent(String(stakeAddr)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; +export const AccountsApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns a list of addresses seen on-chain which use the specified stake key + * @summary Stake account addresses + * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') + * @param {AccountAddressesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + accountAddresses: async ( + stakeAddr: string, + localVarQueryParameter: AccountAddressesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'stakeAddr' is not null or undefined + assertParamExists('accountAddresses', 'stakeAddr', stakeAddr); + const localVarPath = `/accounts/{stake_addr}/addresses`.replace( + `{${'stake_addr'}}`, + encodeURIComponent(String(stakeAddr)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of native assets which are owned by addresses with the specified stake key - * @summary Stake account assets - * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') - * @param {AccountAssetsQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountAssets: async ( - stakeAddr: string, - localVarQueryParameter: AccountAssetsQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'stakeAddr' is not null or undefined - assertParamExists('accountAssets', 'stakeAddr', stakeAddr); - const localVarPath = `/accounts/{stake_addr}/assets`.replace( - `{${'stake_addr'}}`, - encodeURIComponent(String(stakeAddr)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of native assets which are owned by addresses with the specified stake key + * @summary Stake account assets + * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') + * @param {AccountAssetsQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + accountAssets: async ( + stakeAddr: string, + localVarQueryParameter: AccountAssetsQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'stakeAddr' is not null or undefined + assertParamExists('accountAssets', 'stakeAddr', stakeAddr); + const localVarPath = `/accounts/{stake_addr}/assets`.replace( + `{${'stake_addr'}}`, + encodeURIComponent(String(stakeAddr)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - ...HEADER_AMOUNTS_AS_STRING, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns per-epoch history for the specified stake key - * @summary Stake account history - * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {AccountHistoryQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountHistory: async ( - stakeAddr: string, - localVarQueryParameter: AccountHistoryQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'stakeAddr' is not null or undefined - assertParamExists('accountHistory', 'stakeAddr', stakeAddr); - const localVarPath = `/accounts/{stake_addr}/history`.replace( - `{${'stake_addr'}}`, - encodeURIComponent(String(stakeAddr)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns per-epoch history for the specified stake key + * @summary Stake account history + * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') + * @param {AccountHistoryQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + accountHistory: async ( + stakeAddr: string, + localVarQueryParameter: AccountHistoryQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'stakeAddr' is not null or undefined + assertParamExists('accountHistory', 'stakeAddr', stakeAddr); + const localVarPath = `/accounts/{stake_addr}/history`.replace( + `{${'stake_addr'}}`, + encodeURIComponent(String(stakeAddr)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns various information regarding a stake account - * @summary Stake account information - * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountInfo: async (stakeAddr: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'stakeAddr' is not null or undefined - assertParamExists('accountInfo', 'stakeAddr', stakeAddr); - const localVarPath = `/accounts/{stake_addr}`.replace( - `{${'stake_addr'}}`, - encodeURIComponent(String(stakeAddr)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns various information regarding a stake account + * @summary Stake account information + * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + accountInfo: async (stakeAddr: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'stakeAddr' is not null or undefined + assertParamExists('accountInfo', 'stakeAddr', stakeAddr); + const localVarPath = `/accounts/{stake_addr}`.replace( + `{${'stake_addr'}}`, + encodeURIComponent(String(stakeAddr)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`) - * @summary Stake account rewards - * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {AccountRewardsQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountRewards: async ( - stakeAddr: string, - localVarQueryParameter: AccountRewardsQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'stakeAddr' is not null or undefined - assertParamExists('accountRewards', 'stakeAddr', stakeAddr); - const localVarPath = `/accounts/{stake_addr}/rewards`.replace( - `{${'stake_addr'}}`, - encodeURIComponent(String(stakeAddr)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`) + * @summary Stake account rewards + * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') + * @param {AccountRewardsQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + accountRewards: async ( + stakeAddr: string, + localVarQueryParameter: AccountRewardsQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'stakeAddr' is not null or undefined + assertParamExists('accountRewards', 'stakeAddr', stakeAddr); + const localVarPath = `/accounts/{stake_addr}/rewards`.replace( + `{${'stake_addr'}}`, + encodeURIComponent(String(stakeAddr)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`) - * @summary Stake account updates - * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {AccountUpdatesQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountUpdates: async ( - stakeAddr: string, - localVarQueryParameter: AccountUpdatesQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'stakeAddr' is not null or undefined - assertParamExists('accountUpdates', 'stakeAddr', stakeAddr); - const localVarPath = `/accounts/{stake_addr}/updates`.replace( - `{${'stake_addr'}}`, - encodeURIComponent(String(stakeAddr)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`) + * @summary Stake account updates + * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') + * @param {AccountUpdatesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + accountUpdates: async ( + stakeAddr: string, + localVarQueryParameter: AccountUpdatesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'stakeAddr' is not null or undefined + assertParamExists('accountUpdates', 'stakeAddr', stakeAddr); + const localVarPath = `/accounts/{stake_addr}/updates`.replace( + `{${'stake_addr'}}`, + encodeURIComponent(String(stakeAddr)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; -// /** -// * AccountsApi - factory interface -// * @export -// */ -// export const AccountsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = AccountsApiFp(configuration); -// return { -// /** -// * Returns a list of addresses seen on-chain which use the specified stake key -// * @summary Stake account addresses -// * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') -// * @param {AccountAddressesQueryParams} [queryParams] Query parameters. -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// accountAddresses( -// stakeAddr: string, -// queryParams: AccountAddressesQueryParams, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .accountAddresses(stakeAddr, queryParams, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of native assets which are owned by addresses with the specified stake key -// * @summary Stake account assets -// * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') -// * @param {string | null} [policy] Filter results to only show assets of the specified policy -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// accountAssets( -// stakeAddr: string, -// policy?: string | null, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .accountAssets(stakeAddr, policy, count, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns per-epoch history for the specified stake key -// * @summary Stake account history -// * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') -// * @param {number | null} [epochNo] Fetch result for only a specific epoch -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// accountHistory( -// stakeAddr: string, -// epochNo?: number | null, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .accountHistory(stakeAddr, epochNo, count, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns various information regarding a stake account -// * @summary Stake account information -// * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// accountInfo(stakeAddr: string, options?: any): AxiosPromise { -// return localVarFp.accountInfo(stakeAddr, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`) -// * @summary Stake account rewards -// * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// accountRewards( -// stakeAddr: string, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .accountRewards(stakeAddr, count, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`) -// * @summary Stake account updates -// * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// accountUpdates( -// stakeAddr: string, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .accountUpdates(stakeAddr, count, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// }; -// }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * AccountsApi - functional programming interface * @export */ -export const AccountsApiFp = function (configuration: Configuration) { +export const AccountsApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = AccountsApiAxiosParamCreator(configuration); return { /** diff --git a/src/api/addresses/helpers.ts b/src/api/addresses/helpers.ts index 148bba1..6ffa41c 100644 --- a/src/api/addresses/helpers.ts +++ b/src/api/addresses/helpers.ts @@ -32,390 +32,388 @@ import { * AddressesApi - axios parameter creator * @export */ -export const AddressesApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns the different information encoded within a Cardano address, including details of the payment and delegation parts of the address - * @summary Decode address - * @param {string} address Address in bech32/hex/base58 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - decodeAddress: async (address: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'address' is not null or undefined - assertParamExists('decodeAddress', 'address', address); - const localVarPath = `/addresses/{address}/decode`.replace( - `{${'address'}}`, - encodeURIComponent(String(address)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the number of transactions in which the address spent or received some funds. Specifically, the number of transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). - * @summary Address transaction count - * @param {string} address Address in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txCountByAddress: async (address: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'address' is not null or undefined - assertParamExists('txCountByAddress', 'address', address); - const localVarPath = `/addresses/{address}/transactions/count`.replace( - `{${'address'}}`, - encodeURIComponent(String(address)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). - * @summary Address transactions - * @param {string} address Address in bech32 format - * @param {TxsByAddressQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txsByAddress: async ( - address: string, - localVarQueryParameter?: TxsByAddressQueryParams, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'address' is not null or undefined - assertParamExists('txsByAddress', 'address', address); - const localVarPath = `/addresses/{address}/transactions`.replace( - `{${'address'}}`, - encodeURIComponent(String(address)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). - * @summary Payment credential transactions - * @param {string} credential Payment credential in bech32 format - * @param {TxsByPaymentCredQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txsByPaymentCred: async ( - credential: string, - localVarQueryParameter: TxsByPaymentCredQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'credential' is not null or undefined - assertParamExists('txsByPaymentCred', 'credential', credential); - const localVarPath = `/addresses/cred/{credential}/transactions`.replace( - `{${'credential'}}`, - encodeURIComponent(String(credential)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address - * @summary UTxO references at an address - * @param {string} address Address in bech32 format - * @param {UtxoRefsAtAddressQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - utxoRefsAtAddress: async ( - address: string, - localVarQueryParameter: UtxoRefsAtAddressQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'address' is not null or undefined - assertParamExists('utxoRefsAtAddress', 'address', address); - const localVarPath = `/addresses/{address}/utxo_refs`.replace( - `{${'address'}}`, - encodeURIComponent(String(address)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Return detailed information on UTxOs controlled by an address - * @summary UTxOs at an address - * @param {string} address Address in bech32 format - * @param {UtxosByAddressQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - utxosByAddress: async ( - address: string, - localVarQueryParameter: UtxosByAddressQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'address' is not null or undefined - assertParamExists('utxosByAddress', 'address', address); - const localVarPath = `/addresses/{address}/utxos`.replace( - `{${'address'}}`, - encodeURIComponent(String(address)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - ...HEADER_AMOUNTS_AS_STRING, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Return detailed information on UTxOs which are controlled by some address in the specified list of addresses - * @summary UTxOs at multiple addresses - * @param {Array} requestBody - * @param {UtxosByAddressesQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - utxosByAddresses: async ( - requestBody: Array, - localVarQueryParameter: UtxosByAddressesQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'requestBody' is not null or undefined - assertParamExists('utxosByAddresses', 'requestBody', requestBody); - const localVarPath = `/addresses/utxos`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - ...HEADER_AMOUNTS_AS_STRING, - }; - localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Return detailed information on UTxOs controlled by addresses which use the specified payment credential - * @summary UTxOs by payment credential - * @param {string} credential Payment credential in bech32 format - * @param {UtxosByPaymentCredQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - utxosByPaymentCred: async ( - credential: string, - localVarQueryParameter: UtxosByPaymentCredQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'credential' is not null or undefined - assertParamExists('utxosByPaymentCred', 'credential', credential); - const localVarPath = `/addresses/cred/{credential}/utxos`.replace( - `{${'credential'}}`, - encodeURIComponent(String(credential)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - ...HEADER_AMOUNTS_AS_STRING, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Return detailed information on UTxOs which are controlled by some payment credentials in the specified list of payment credentials - * @summary UTxOs at multiple payment credentials - * @param {Array} requestBody - * @param {UtxosByAddressesQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - utxosByPaymentCreds: async ( - requestBody: Array, - localVarQueryParameter: UtxosByAddressesQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'requestBody' is not null or undefined - assertParamExists('utxosByPaymentCreds', 'requestBody', requestBody); - const localVarPath = `/addresses/cred/utxos`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - ...HEADER_AMOUNTS_AS_STRING, - }; - localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; +export const AddressesApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns the different information encoded within a Cardano address, including details of the payment and delegation parts of the address + * @summary Decode address + * @param {string} address Address in bech32/hex/base58 format + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + decodeAddress: async (address: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'address' is not null or undefined + assertParamExists('decodeAddress', 'address', address); + const localVarPath = `/addresses/{address}/decode`.replace( + `{${'address'}}`, + encodeURIComponent(String(address)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the number of transactions in which the address spent or received some funds. Specifically, the number of transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). + * @summary Address transaction count + * @param {string} address Address in bech32 format + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txCountByAddress: async (address: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'address' is not null or undefined + assertParamExists('txCountByAddress', 'address', address); + const localVarPath = `/addresses/{address}/transactions/count`.replace( + `{${'address'}}`, + encodeURIComponent(String(address)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). + * @summary Address transactions + * @param {string} address Address in bech32 format + * @param {TxsByAddressQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txsByAddress: async ( + address: string, + localVarQueryParameter?: TxsByAddressQueryParams, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'address' is not null or undefined + assertParamExists('txsByAddress', 'address', address); + const localVarPath = `/addresses/{address}/transactions`.replace( + `{${'address'}}`, + encodeURIComponent(String(address)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). + * @summary Payment credential transactions + * @param {string} credential Payment credential in bech32 format + * @param {TxsByPaymentCredQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txsByPaymentCred: async ( + credential: string, + localVarQueryParameter: TxsByPaymentCredQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'credential' is not null or undefined + assertParamExists('txsByPaymentCred', 'credential', credential); + const localVarPath = `/addresses/cred/{credential}/transactions`.replace( + `{${'credential'}}`, + encodeURIComponent(String(credential)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address + * @summary UTxO references at an address + * @param {string} address Address in bech32 format + * @param {UtxoRefsAtAddressQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + utxoRefsAtAddress: async ( + address: string, + localVarQueryParameter: UtxoRefsAtAddressQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'address' is not null or undefined + assertParamExists('utxoRefsAtAddress', 'address', address); + const localVarPath = `/addresses/{address}/utxo_refs`.replace( + `{${'address'}}`, + encodeURIComponent(String(address)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Return detailed information on UTxOs controlled by an address + * @summary UTxOs at an address + * @param {string} address Address in bech32 format + * @param {UtxosByAddressQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + utxosByAddress: async ( + address: string, + localVarQueryParameter: UtxosByAddressQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'address' is not null or undefined + assertParamExists('utxosByAddress', 'address', address); + const localVarPath = `/addresses/{address}/utxos`.replace( + `{${'address'}}`, + encodeURIComponent(String(address)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Return detailed information on UTxOs which are controlled by some address in the specified list of addresses + * @summary UTxOs at multiple addresses + * @param {Array} requestBody + * @param {UtxosByAddressesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + utxosByAddresses: async ( + requestBody: Array, + localVarQueryParameter: UtxosByAddressesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('utxosByAddresses', 'requestBody', requestBody); + const localVarPath = `/addresses/utxos`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, + }; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Return detailed information on UTxOs controlled by addresses which use the specified payment credential + * @summary UTxOs by payment credential + * @param {string} credential Payment credential in bech32 format + * @param {UtxosByPaymentCredQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + utxosByPaymentCred: async ( + credential: string, + localVarQueryParameter: UtxosByPaymentCredQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'credential' is not null or undefined + assertParamExists('utxosByPaymentCred', 'credential', credential); + const localVarPath = `/addresses/cred/{credential}/utxos`.replace( + `{${'credential'}}`, + encodeURIComponent(String(credential)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Return detailed information on UTxOs which are controlled by some payment credentials in the specified list of payment credentials + * @summary UTxOs at multiple payment credentials + * @param {Array} requestBody + * @param {UtxosByAddressesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + utxosByPaymentCreds: async ( + requestBody: Array, + localVarQueryParameter: UtxosByAddressesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('utxosByPaymentCreds', 'requestBody', requestBody); + const localVarPath = `/addresses/cred/utxos`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, + }; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * AddressesApi - functional programming interface * @export */ -export const AddressesApiFp = function (configuration: Configuration) { +export const AddressesApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = AddressesApiAxiosParamCreator(configuration); return { /** @@ -576,189 +574,3 @@ export const AddressesApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * AddressesApi - factory interface -// * @export -// */ -// export const AddressesApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = AddressesApiFp(configuration); -// return { -// /** -// * Returns the different information encoded within a Cardano address, including details of the payment and delegation parts of the address -// * @summary Decode address -// * @param {string} address Address in bech32/hex/base58 format -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// decodeAddress(address: string, options?: any): AxiosPromise { -// return localVarFp.decodeAddress(address, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns the number of transactions in which the address spent or received some funds. Specifically, the number of transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). -// * @summary Address transaction count -// * @param {string} address Address in bech32 format -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txCountByAddress(address: string, options?: any): AxiosPromise { -// return localVarFp.txCountByAddress(address, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). -// * @summary Address transactions -// * @param {string} address Address in bech32 format -// * @param {number | null} [count] The max number of results per page -// * @param {TxsByAddressOrderEnum} [order] The order in which the results are sorted, by transaction age) -// * @param {number | null} [from] Return only transactions minted on or after a specific slot -// * @param {number | null} [to] Return only transactions minted on or before a specific slot -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txsByAddress( -// address: string, -// count?: number | null, -// order?: TxsByAddressOrderEnum, -// from?: number | null, -// to?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .txsByAddress(address, count, order, from, to, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). -// * @summary Payment credential transactions -// * @param {string} credential Payment credential in bech32 format -// * @param {number | null} [count] The max number of results per page -// * @param {TxsByPaymentCredOrderEnum} [order] The order in which the results are sorted, by transaction age) -// * @param {number | null} [from] Return only transactions minted on or after a specific slot -// * @param {number | null} [to] Return only transactions minted on or before a specific slot -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txsByPaymentCred( -// credential: string, -// count?: number | null, -// order?: TxsByPaymentCredOrderEnum, -// from?: number | null, -// to?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .txsByPaymentCred(credential, count, order, from, to, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address -// * @summary UTxO references at an address -// * @param {string} address Address in bech32 format -// * @param {number | null} [count] The max number of results per page -// * @param {UtxoRefsAtAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) -// * @param {number | null} [from] Return only UTxOs created on or after a specific slot -// * @param {number | null} [to] Return only UTxOs created before a specific slot -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// utxoRefsAtAddress( -// address: string, -// count?: number | null, -// order?: UtxoRefsAtAddressOrderEnum, -// from?: number | null, -// to?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .utxoRefsAtAddress(address, count, order, from, to, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Return detailed information on UTxOs controlled by an address -// * @summary UTxOs at an address -// * @param {string} address Address in bech32 format -// * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes -// * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response -// * @param {number | null} [count] The max number of results per page -// * @param {UtxosByAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) -// * @param {number | null} [from] Return only UTxOs created on or after a specific slot -// * @param {number | null} [to] Return only UTxOs created before a specific slot -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// utxosByAddress( -// address: string, -// resolveDatums?: boolean | null, -// withCbor?: boolean | null, -// count?: number | null, -// order?: UtxosByAddressOrderEnum, -// from?: number | null, -// to?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .utxosByAddress(address, resolveDatums, withCbor, count, order, from, to, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Return detailed information on UTxOs which are controlled by some address in the specified list of addresses -// * @summary UTxOs at multiple addresses -// * @param {Array} requestBody -// * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes -// * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// utxosByAddresses( -// requestBody: Array, -// resolveDatums?: boolean | null, -// withCbor?: boolean | null, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .utxosByAddresses(requestBody, resolveDatums, withCbor, count, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Return detailed information on UTxOs controlled by addresses which use the specified payment credential -// * @summary UTxOs by payment credential -// * @param {string} credential Payment credential in bech32 format -// * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes -// * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response -// * @param {number | null} [count] The max number of results per page -// * @param {UtxosByPaymentCredOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) -// * @param {number | null} [from] Return only UTxOs created on or after a specific slot -// * @param {number | null} [to] Return only UTxOs created on or before a specific slot -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// utxosByPaymentCred( -// credential: string, -// resolveDatums?: boolean | null, -// withCbor?: boolean | null, -// count?: number | null, -// order?: UtxosByPaymentCredOrderEnum, -// from?: number | null, -// to?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .utxosByPaymentCred(credential, resolveDatums, withCbor, count, order, from, to, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/assets/helpers.ts b/src/api/assets/helpers.ts index a57f860..f45e481 100644 --- a/src/api/assets/helpers.ts +++ b/src/api/assets/helpers.ts @@ -38,456 +38,448 @@ import { * AssetsApi - axios parameter creator * @export */ -export const AssetsApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of the specified asset; in other words, instead of returning the addresses which hold some of the asset, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). - * @summary Accounts of addresses holding specific asset - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {AssetAccountsQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetAccounts: async ( - asset: string, - localVarQueryParameter: AssetAccountsQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'asset' is not null or undefined - assertParamExists('assetAccounts', 'asset', asset); - const localVarPath = `/assets/{asset}/accounts`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of addresses which control some amount of the specified asset - * @summary Native asset addresses - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {AssetAddressesQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetAddresses: async ( - asset: string, - localVarQueryParameter: AssetAddressesQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'asset' is not null or undefined - assertParamExists('assetAddresses', 'asset', asset); - const localVarPath = `/assets/{asset}/addresses`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Return a summary of information about an asset - * @summary Native asset information - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetInfo: async (asset: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'asset' is not null or undefined - assertParamExists('assetInfo', 'asset', asset); - const localVarPath = `/assets/{asset}`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of transactions in which a transaction input or output contains some of the specified asset - * @summary Native asset transactions - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {AssetTxsQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetTxs: async ( - asset: string, - localVarQueryParameter: AssetTxsQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'asset' is not null or undefined - assertParamExists('assetTxs', 'asset', asset); - const localVarPath = `/assets/{asset}/transactions`.replace( - `{${'asset'}}`, - encodeURIComponent(String(asset)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of transactions in which some of the specified asset was minted or burned - * @summary Native asset updates - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {AssetUpdatesQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetUpdates: async ( - asset: string, - localVarQueryParameter: AssetUpdatesQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'asset' is not null or undefined - assertParamExists('assetUpdates', 'asset', asset); - const localVarPath = `/assets/{asset}/updates`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns references for UTxOs which contain some of the specified asset, each paired with the amount of the asset contained in the UTxO - * @summary Native asset UTxOs - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {AssetUpdatesQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetUtxos: async ( - asset: string, - localVarQueryParameter: AssetUpdatesQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'asset' is not null or undefined - assertParamExists('assetUtxos', 'asset', asset); - const localVarPath = `/assets/{asset}/utxos`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of an asset of the specified policy; in other words, instead of returning the addresses which hold the assets, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). - * @summary Accounts of addresses holding assets of specific policy - * @param {string} policy Hex encoded Policy ID - * @param {PolicyAccountsQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyAccounts: async ( - policy: string, - localVarQueryParameter: PolicyAccountsQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'policy' is not null or undefined - assertParamExists('policyAccounts', 'policy', policy); - const localVarPath = `/assets/policy/{policy}/accounts`.replace( - `{${'policy'}}`, - encodeURIComponent(String(policy)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of addresses which hold some of an asset of the specified policy ID - * @summary Addresses holding assets of specific policy - * @param {string} policy Hex encoded Policy ID - * @param {PolicyAddressesQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyAddresses: async ( - policy: string, - localVarQueryParameter: PolicyAddressesQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'policy' is not null or undefined - assertParamExists('policyAddresses', 'policy', policy); - const localVarPath = `/assets/policy/{policy}/addresses`.replace( - `{${'policy'}}`, - encodeURIComponent(String(policy)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns information about assets of the specified minting policy ID - * @summary Information on assets of specific policy - * @param {string} policy Hex encoded policy ID - * @param {PolicyInfoQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyInfo: async ( - policy: string, - localVarQueryParameter: PolicyInfoQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'policy' is not null or undefined - assertParamExists('policyInfo', 'policy', policy); - const localVarPath = `/assets/policy/{policy}`.replace(`{${'policy'}}`, encodeURIComponent(String(policy))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of transactions in which a transaction input or output contains some of at least one asset of the specified minting policy ID - * @summary Transactions moving assets of specific policy - * @param {string} policy Hex encoded policy ID - * @param {PolicyTxsQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyTxs: async ( - policy: string, - localVarQueryParameter: PolicyTxsQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'policy' is not null or undefined - assertParamExists('policyTxs', 'policy', policy); - const localVarPath = `/assets/policy/{policy}/txs`.replace( - `{${'policy'}}`, - encodeURIComponent(String(policy)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns UTxO references of UTxOs which contain some of at least one asset of the specified policy ID, each paired with a list of assets of the policy contained in the UTxO and the corresponding amounts - * @summary UTxOs containing assets of specific policy - * @param {string} policy Hex encoded policy ID - * @param {PolicyUtxosQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyUtxos: async ( - policy: string, - localVarQueryParameter: PolicyUtxosQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'policy' is not null or undefined - assertParamExists('policyUtxos', 'policy', policy); - const localVarPath = `/assets/policy/{policy}/utxos`.replace( - `{${'policy'}}`, - encodeURIComponent(String(policy)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; +export const AssetsApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of the specified asset; in other words, instead of returning the addresses which hold some of the asset, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). + * @summary Accounts of addresses holding specific asset + * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name + * @param {AssetAccountsQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assetAccounts: async ( + asset: string, + localVarQueryParameter: AssetAccountsQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'asset' is not null or undefined + assertParamExists('assetAccounts', 'asset', asset); + const localVarPath = `/assets/{asset}/accounts`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of addresses which control some amount of the specified asset + * @summary Native asset addresses + * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name + * @param {AssetAddressesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assetAddresses: async ( + asset: string, + localVarQueryParameter: AssetAddressesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'asset' is not null or undefined + assertParamExists('assetAddresses', 'asset', asset); + const localVarPath = `/assets/{asset}/addresses`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Return a summary of information about an asset + * @summary Native asset information + * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assetInfo: async (asset: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'asset' is not null or undefined + assertParamExists('assetInfo', 'asset', asset); + const localVarPath = `/assets/{asset}`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of transactions in which a transaction input or output contains some of the specified asset + * @summary Native asset transactions + * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name + * @param {AssetTxsQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assetTxs: async ( + asset: string, + localVarQueryParameter: AssetTxsQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'asset' is not null or undefined + assertParamExists('assetTxs', 'asset', asset); + const localVarPath = `/assets/{asset}/transactions`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of transactions in which some of the specified asset was minted or burned + * @summary Native asset updates + * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name + * @param {AssetUpdatesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assetUpdates: async ( + asset: string, + localVarQueryParameter: AssetUpdatesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'asset' is not null or undefined + assertParamExists('assetUpdates', 'asset', asset); + const localVarPath = `/assets/{asset}/updates`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns references for UTxOs which contain some of the specified asset, each paired with the amount of the asset contained in the UTxO + * @summary Native asset UTxOs + * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name + * @param {AssetUpdatesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assetUtxos: async ( + asset: string, + localVarQueryParameter: AssetUpdatesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'asset' is not null or undefined + assertParamExists('assetUtxos', 'asset', asset); + const localVarPath = `/assets/{asset}/utxos`.replace(`{${'asset'}}`, encodeURIComponent(String(asset))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of an asset of the specified policy; in other words, instead of returning the addresses which hold the assets, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). + * @summary Accounts of addresses holding assets of specific policy + * @param {string} policy Hex encoded Policy ID + * @param {PolicyAccountsQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + policyAccounts: async ( + policy: string, + localVarQueryParameter: PolicyAccountsQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'policy' is not null or undefined + assertParamExists('policyAccounts', 'policy', policy); + const localVarPath = `/assets/policy/{policy}/accounts`.replace( + `{${'policy'}}`, + encodeURIComponent(String(policy)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of addresses which hold some of an asset of the specified policy ID + * @summary Addresses holding assets of specific policy + * @param {string} policy Hex encoded Policy ID + * @param {PolicyAddressesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + policyAddresses: async ( + policy: string, + localVarQueryParameter: PolicyAddressesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'policy' is not null or undefined + assertParamExists('policyAddresses', 'policy', policy); + const localVarPath = `/assets/policy/{policy}/addresses`.replace( + `{${'policy'}}`, + encodeURIComponent(String(policy)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns information about assets of the specified minting policy ID + * @summary Information on assets of specific policy + * @param {string} policy Hex encoded policy ID + * @param {PolicyInfoQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + policyInfo: async ( + policy: string, + localVarQueryParameter: PolicyInfoQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'policy' is not null or undefined + assertParamExists('policyInfo', 'policy', policy); + const localVarPath = `/assets/policy/{policy}`.replace(`{${'policy'}}`, encodeURIComponent(String(policy))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of transactions in which a transaction input or output contains some of at least one asset of the specified minting policy ID + * @summary Transactions moving assets of specific policy + * @param {string} policy Hex encoded policy ID + * @param {PolicyTxsQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + policyTxs: async ( + policy: string, + localVarQueryParameter: PolicyTxsQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'policy' is not null or undefined + assertParamExists('policyTxs', 'policy', policy); + const localVarPath = `/assets/policy/{policy}/txs`.replace(`{${'policy'}}`, encodeURIComponent(String(policy))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns UTxO references of UTxOs which contain some of at least one asset of the specified policy ID, each paired with a list of assets of the policy contained in the UTxO and the corresponding amounts + * @summary UTxOs containing assets of specific policy + * @param {string} policy Hex encoded policy ID + * @param {PolicyUtxosQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + policyUtxos: async ( + policy: string, + localVarQueryParameter: PolicyUtxosQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'policy' is not null or undefined + assertParamExists('policyUtxos', 'policy', policy); + const localVarPath = `/assets/policy/{policy}/utxos`.replace( + `{${'policy'}}`, + encodeURIComponent(String(policy)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * AssetsApi - functional programming interface * @export */ -export const AssetsApiFp = function (configuration: Configuration) { +export const AssetsApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = AssetsApiAxiosParamCreator(configuration); return { /** @@ -666,231 +658,3 @@ export const AssetsApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * AssetsApi - factory interface -// * @export -// */ -// export const AssetsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = AssetsApiFp(configuration); -// return { -// /** -// * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of the specified asset; in other words, instead of returning the addresses which hold some of the asset, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). -// * @summary Accounts of addresses holding specific asset -// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// assetAccounts( -// asset: string, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp.assetAccounts(asset, count, cursor, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of addresses which control some amount of the specified asset -// * @summary Native asset addresses -// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// assetAddresses( -// asset: string, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp.assetAddresses(asset, count, cursor, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Return a summary of information about an asset -// * @summary Native asset information -// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// assetInfo(asset: string, options?: any): AxiosPromise { -// return localVarFp.assetInfo(asset, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of transactions in which a transaction input or output contains some of the specified asset -// * @summary Native asset transactions -// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name -// * @param {number | null} [fromHeight] Return only transactions after supplied block height -// * @param {number | null} [count] The max number of results per page -// * @param {AssetTxsOrderEnum} [order] The order in which the results are sorted (by block height) -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// assetTxs( -// asset: string, -// fromHeight?: number | null, -// count?: number | null, -// order?: AssetTxsOrderEnum, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .assetTxs(asset, fromHeight, count, order, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of transactions in which some of the specified asset was minted or burned -// * @summary Native asset updates -// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name -// * @param {number | null} [count] The max number of results per page -// * @param {AssetUpdatesOrderEnum} [order] The order in which the results are sorted (by block height) -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// assetUpdates( -// asset: string, -// count?: number | null, -// order?: AssetUpdatesOrderEnum, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .assetUpdates(asset, count, order, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns references for UTxOs which contain some of the specified asset, each paired with the amount of the asset contained in the UTxO -// * @summary Native asset UTxOs -// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name -// * @param {string | null} [address] Return only UTxOs controlled by a specific address (bech32 encoding) -// * @param {number | null} [count] The max number of results per page -// * @param {AssetUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) -// * @param {number | null} [from] Return only UTxOs created on or after a specific slot -// * @param {number | null} [to] Return only UTxOs created before a specific slot -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// assetUtxos( -// asset: string, -// address?: string | null, -// count?: number | null, -// order?: AssetUtxosOrderEnum, -// from?: number | null, -// to?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .assetUtxos(asset, address, count, order, from, to, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of an asset of the specified policy; in other words, instead of returning the addresses which hold the assets, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). -// * @summary Accounts of addresses holding assets of specific policy -// * @param {string} policy Hex encoded Policy ID -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// policyAccounts( -// policy: string, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .policyAccounts(policy, count, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of addresses which hold some of an asset of the specified policy ID -// * @summary Addresses holding assets of specific policy -// * @param {string} policy Hex encoded Policy ID -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// policyAddresses( -// policy: string, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .policyAddresses(policy, count, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns information about assets of the specified minting policy ID -// * @summary Information on assets of specific policy -// * @param {string} policy Hex encoded policy ID -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// policyInfo( -// policy: string, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp.policyInfo(policy, count, cursor, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of transactions in which a transaction input or output contains some of at least one asset of the specified minting policy ID -// * @summary Transactions moving assets of specific policy -// * @param {string} policy Hex encoded policy ID -// * @param {number | null} [fromHeight] Return only transactions after supplied block height -// * @param {number | null} [count] The max number of results per page -// * @param {PolicyTxsOrderEnum} [order] The order in which the results are sorted (by block height) -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// policyTxs( -// policy: string, -// fromHeight?: number | null, -// count?: number | null, -// order?: PolicyTxsOrderEnum, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .policyTxs(policy, fromHeight, count, order, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns UTxO references of UTxOs which contain some of at least one asset of the specified policy ID, each paired with a list of assets of the policy contained in the UTxO and the corresponding amounts -// * @summary UTxOs containing assets of specific policy -// * @param {string} policy Hex encoded policy ID -// * @param {number | null} [count] The max number of results per page -// * @param {PolicyUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) -// * @param {number | null} [from] Return only UTxOs created on or after a specific slot -// * @param {number | null} [to] Return only UTxOs created before a specific slot -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// policyUtxos( -// policy: string, -// count?: number | null, -// order?: PolicyUtxosOrderEnum, -// from?: number | null, -// to?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .policyUtxos(policy, count, order, from, to, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/blocks/helpers.ts b/src/api/blocks/helpers.ts index ff319ef..4c8685e 100644 --- a/src/api/blocks/helpers.ts +++ b/src/api/blocks/helpers.ts @@ -15,54 +15,52 @@ import { TimestampedBlockInfo } from '../type'; * BlocksApi - axios parameter creator * @export */ -export const BlocksApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns information about the specified block including more advanced technical properties - * @summary Block information - * @param {string} hashOrHeight Block height or hex encoded block hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - blockInfo: async (hashOrHeight: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'hashOrHeight' is not null or undefined - assertParamExists('blockInfo', 'hashOrHeight', hashOrHeight); - const localVarPath = `/blocks/{hash_or_height}`.replace( - `{${'hash_or_height'}}`, - encodeURIComponent(String(hashOrHeight)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; +export const BlocksApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns information about the specified block including more advanced technical properties + * @summary Block information + * @param {string} hashOrHeight Block height or hex encoded block hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + blockInfo: async (hashOrHeight: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'hashOrHeight' is not null or undefined + assertParamExists('blockInfo', 'hashOrHeight', hashOrHeight); + const localVarPath = `/blocks/{hash_or_height}`.replace( + `{${'hash_or_height'}}`, + encodeURIComponent(String(hashOrHeight)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * BlocksApi - functional programming interface * @export */ -export const BlocksApiFp = function (configuration: Configuration) { +export const BlocksApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = BlocksApiAxiosParamCreator(configuration); return { /** @@ -81,23 +79,3 @@ export const BlocksApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * BlocksApi - factory interface -// * @export -// */ -// export const BlocksApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = BlocksApiFp(configuration); -// return { -// /** -// * Returns information about the specified block including more advanced technical properties -// * @summary Block information -// * @param {string} hashOrHeight Block height or hex encoded block hash -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// blockInfo(hashOrHeight: string, options?: any): AxiosPromise { -// return localVarFp.blockInfo(hashOrHeight, options).then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/datum/helpers.ts b/src/api/datum/helpers.ts index b07c137..ee0a9e3 100644 --- a/src/api/datum/helpers.ts +++ b/src/api/datum/helpers.ts @@ -16,92 +16,87 @@ import { TimestampedDatum, TimestampedDatums } from '../type'; * DatumApi - axios parameter creator * @export */ -export const DatumApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns the datum corresponding to the specified datum hash, if the datum has been seen on-chain - * @summary Datum by datum hash - * @param {string} datumHash Hex encoded datum hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - lookupDatum: async (datumHash: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'datumHash' is not null or undefined - assertParamExists('lookupDatum', 'datumHash', datumHash); - const localVarPath = `/datums/{datum_hash}`.replace( - `{${'datum_hash'}}`, - encodeURIComponent(String(datumHash)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; +export const DatumApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns the datum corresponding to the specified datum hash, if the datum has been seen on-chain + * @summary Datum by datum hash + * @param {string} datumHash Hex encoded datum hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + lookupDatum: async (datumHash: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'datumHash' is not null or undefined + assertParamExists('lookupDatum', 'datumHash', datumHash); + const localVarPath = `/datums/{datum_hash}`.replace(`{${'datum_hash'}}`, encodeURIComponent(String(datumHash))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the datums corresponding to the specified datum hashes, for the datums which have been seen on-chain - * @summary Datums by datum hashes - * @param {Array} requestBody Array of hex encoded datum hashes - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - lookupDatums: async (requestBody: Array, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'requestBody' is not null or undefined - assertParamExists('lookupDatums', 'requestBody', requestBody); - const localVarPath = `/datums`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the datums corresponding to the specified datum hashes, for the datums which have been seen on-chain + * @summary Datums by datum hashes + * @param {Array} requestBody Array of hex encoded datum hashes + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + lookupDatums: async (requestBody: Array, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('lookupDatums', 'requestBody', requestBody); + const localVarPath = `/datums`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * DatumApi - functional programming interface * @export */ -export const DatumApiFp = function (configuration: Configuration) { +export const DatumApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = DatumApiAxiosParamCreator(configuration); return { /** @@ -134,23 +129,3 @@ export const DatumApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * DatumApi - factory interface -// * @export -// */ -// export const DatumApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = DatumApiFp(configuration); -// return { -// /** -// * Returns the datum corresponding to the specified datum hash, if the datum has been seen on-chain -// * @summary Datum by datum hash -// * @param {string} datumHash Hex encoded datum hash -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// lookupDatum(datumHash: string, options?: any): AxiosPromise { -// return localVarFp.lookupDatum(datumHash, options).then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/ecosystem/helpers.ts b/src/api/ecosystem/helpers.ts index a924ba7..13f805d 100644 --- a/src/api/ecosystem/helpers.ts +++ b/src/api/ecosystem/helpers.ts @@ -15,54 +15,52 @@ import { TimestampedAddress } from '../type'; * EcosystemApi - axios parameter creator * @export */ -export const EcosystemApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns the Cardano address corresponding to an ADA Handle - * @summary Resolve ADA Handle - * @param {string} handle Ada Handle to resolve - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - adahandleResolve: async (handle: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'handle' is not null or undefined - assertParamExists('adahandleResolve', 'handle', handle); - const localVarPath = `/ecosystem/adahandle/{handle}`.replace( - `{${'handle'}}`, - encodeURIComponent(String(handle)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; +export const EcosystemApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns the Cardano address corresponding to an ADA Handle + * @summary Resolve ADA Handle + * @param {string} handle Ada Handle to resolve + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + adahandleResolve: async (handle: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'handle' is not null or undefined + assertParamExists('adahandleResolve', 'handle', handle); + const localVarPath = `/ecosystem/adahandle/{handle}`.replace( + `{${'handle'}}`, + encodeURIComponent(String(handle)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * EcosystemApi - functional programming interface * @export */ -export const EcosystemApiFp = function (configuration: Configuration) { +export const EcosystemApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = EcosystemApiAxiosParamCreator(configuration); return { /** @@ -81,23 +79,3 @@ export const EcosystemApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * EcosystemApi - factory interface -// * @export -// */ -// export const EcosystemApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = EcosystemApiFp(configuration); -// return { -// /** -// * Returns the Cardano address corresponding to an ADA Handle -// * @summary Resolve ADA Handle -// * @param {string} handle Ada Handle to resolve -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// adahandleResolve(handle: string, options?: any): AxiosPromise { -// return localVarFp.adahandleResolve(handle, options).then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/epochs/helpers.ts b/src/api/epochs/helpers.ts index d314644..a66c312 100644 --- a/src/api/epochs/helpers.ts +++ b/src/api/epochs/helpers.ts @@ -15,83 +15,81 @@ import { TimestampedCurrentEpochInfo, TimestampedEpochInfo } from '../type'; * EpochsApi - axios parameter creator * @export */ -export const EpochsApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns a summary of information about the current epoch - * @summary Current epoch details - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - currentEpoch: async (options: AxiosRequestConfig = {}): Promise => { - const localVarPath = `/epochs/current`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; +export const EpochsApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns a summary of information about the current epoch + * @summary Current epoch details + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + currentEpoch: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/epochs/current`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a summary of information about a specific epoch - * @summary Specific epoch details - * @param {number} epochNo Epoch number to return information about - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - epochInfo: async (epochNo: number, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'epochNo' is not null or undefined - assertParamExists('epochInfo', 'epochNo', epochNo); - const localVarPath = `/epochs/{epoch_no}`.replace(`{${'epoch_no'}}`, encodeURIComponent(String(epochNo))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a summary of information about a specific epoch + * @summary Specific epoch details + * @param {number} epochNo Epoch number to return information about + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + epochInfo: async (epochNo: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'epochNo' is not null or undefined + assertParamExists('epochInfo', 'epochNo', epochNo); + const localVarPath = `/epochs/{epoch_no}`.replace(`{${'epoch_no'}}`, encodeURIComponent(String(epochNo))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * EpochsApi - functional programming interface * @export */ -export const EpochsApiFp = function (configuration: Configuration) { +export const EpochsApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = EpochsApiAxiosParamCreator(configuration); return { /** @@ -122,32 +120,3 @@ export const EpochsApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * EpochsApi - factory interface -// * @export -// */ -// export const EpochsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = EpochsApiFp(configuration); -// return { -// /** -// * Returns a summary of information about the current epoch -// * @summary Current epoch details -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// currentEpoch(options?: any): AxiosPromise { -// return localVarFp.currentEpoch(options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a summary of information about a specific epoch -// * @summary Specific epoch details -// * @param {number} epochNo Epoch number to return information about -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// epochInfo(epochNo: number, options?: any): AxiosPromise { -// return localVarFp.epochInfo(epochNo, options).then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/general/helpers.ts b/src/api/general/helpers.ts index a0e14fc..bb4781f 100644 --- a/src/api/general/helpers.ts +++ b/src/api/general/helpers.ts @@ -13,144 +13,142 @@ import { * GeneralApi - axios parameter creator * @export */ -export const GeneralApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns the identifier of the most recently processed block on the network - * @summary Chain tip - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - chainTip: async (options: AxiosRequestConfig = {}): Promise => { - const localVarPath = `/chain-tip`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the blockchain era history - * @summary Era history - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - eraHistory: async (options: AxiosRequestConfig = {}): Promise => { - const localVarPath = `/era-history`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the current blockchain protocol parameters - * @summary Protocol parameters - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - protocolParams: async (options: AxiosRequestConfig = {}): Promise => { - const localVarPath = `/protocol-params`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the blockchain system start time - * @summary Blockchain system start - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - systemStart: async (options: AxiosRequestConfig = {}): Promise => { - const localVarPath = `/system-start`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; +export const GeneralApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns the identifier of the most recently processed block on the network + * @summary Chain tip + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + chainTip: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/chain-tip`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the blockchain era history + * @summary Era history + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + eraHistory: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/era-history`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the current blockchain protocol parameters + * @summary Protocol parameters + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + protocolParams: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/protocol-params`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the blockchain system start time + * @summary Blockchain system start + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + systemStart: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/system-start`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * GeneralApi - functional programming interface * @export */ -export const GeneralApiFp = function (configuration: Configuration) { +export const GeneralApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = GeneralApiAxiosParamCreator(configuration); return { /** @@ -203,49 +201,3 @@ export const GeneralApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * GeneralApi - factory interface -// * @export -// */ -// export const GeneralApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = GeneralApiFp(configuration); -// return { -// /** -// * Returns the identifier of the most recently processed block on the network -// * @summary Chain tip -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// chainTip(options?: any): AxiosPromise { -// return localVarFp.chainTip(options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns the blockchain era history -// * @summary Era history -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// eraHistory(options?: any): AxiosPromise { -// return localVarFp.eraHistory(options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns the current blockchain protocol parameters -// * @summary Protocol parameters -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// protocolParams(options?: any): AxiosPromise { -// return localVarFp.protocolParams(options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns the blockchain system start time -// * @summary Blockchain system start -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// systemStart(options?: any): AxiosPromise { -// return localVarFp.systemStart(options).then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/pools/helpers.ts b/src/api/pools/helpers.ts index 99d5294..a53631f 100644 --- a/src/api/pools/helpers.ts +++ b/src/api/pools/helpers.ts @@ -26,327 +26,310 @@ import { ListPoolsQueryParams, PoolBlocksQueryParams, PoolDelegatorsQueryParams, * PoolsApi - axios parameter creator * @export */ -export const PoolsApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns a list of currently registered stake pools - * @summary List registered stake pools - * @param {ListPoolsQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listPools: async ( - localVarQueryParameter?: ListPoolsQueryParams, - options: AxiosRequestConfig = {}, - ): Promise => { - const localVarPath = `/pools`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Return information about blocks minted by a given pool for all epochs (or just for epoch `epoch_no` if provided) - * @summary Stake pool blocks - * @param {string} poolId Pool ID in bech32 format - * @param {PoolBlocksQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolBlocks: async ( - poolId: string, - localVarQueryParameter: PoolBlocksQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'poolId' is not null or undefined - assertParamExists('poolBlocks', 'poolId', poolId); - const localVarPath = `/pools/{pool_id}/blocks`.replace( - `{${'pool_id'}}`, - encodeURIComponent(String(poolId)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of delegators of the specified pool - * @summary Stake pool delegators - * @param {string} poolId Pool ID in bech32 format - * @param {PoolDelegatorsQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolDelegators: async ( - poolId: string, - localVarQueryParameter: PoolDelegatorsQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'poolId' is not null or undefined - assertParamExists('poolDelegators', 'poolId', poolId); - const localVarPath = `/pools/{pool_id}/delegators`.replace( - `{${'pool_id'}}`, - encodeURIComponent(String(poolId)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns per-epoch information about the specified pool (or just for epoch `epoch_no` if provided) - * @summary Stake pool history - * @param {string} poolId Pool ID in bech32 format - * @param {PoolHistoryQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolHistory: async ( - poolId: string, - localVarQueryParameter: PoolHistoryQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'poolId' is not null or undefined - assertParamExists('poolHistory', 'poolId', poolId); - const localVarPath = `/pools/{pool_id}/history`.replace( - `{${'pool_id'}}`, - encodeURIComponent(String(poolId)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns current information about the specified pool - * @summary Stake pool information - * @param {string} poolId Pool ID in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolInfo: async (poolId: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'poolId' is not null or undefined - assertParamExists('poolInfo', 'poolId', poolId); - const localVarPath = `/pools/{pool_id}/info`.replace(`{${'pool_id'}}`, encodeURIComponent(String(poolId))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - ...HEADER_AMOUNTS_AS_STRING, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the metadata declared on-chain by the specified stake pool - * @summary Stake pool metadata - * @param {string} poolId Pool ID in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolMetadata: async (poolId: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'poolId' is not null or undefined - assertParamExists('poolMetadata', 'poolId', poolId); - const localVarPath = `/pools/{pool_id}/metadata`.replace( - `{${'pool_id'}}`, - encodeURIComponent(String(poolId)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of relays declared on-chain by the specified stake pool - * @summary Stake pool relays - * @param {string} poolId Pool ID in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolRelays: async (poolId: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'poolId' is not null or undefined - assertParamExists('poolRelays', 'poolId', poolId); - const localVarPath = `/pools/{pool_id}/relays`.replace( - `{${'pool_id'}}`, - encodeURIComponent(String(poolId)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns a list of updates relating to the specified pool - * @summary Stake pool updates - * @param {string} poolId Pool ID in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolUpdates: async (poolId: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'poolId' is not null or undefined - assertParamExists('poolUpdates', 'poolId', poolId); - const localVarPath = `/pools/{pool_id}/updates`.replace( - `{${'pool_id'}}`, - encodeURIComponent(String(poolId)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; +export const PoolsApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns a list of currently registered stake pools + * @summary List registered stake pools + * @param {ListPoolsQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listPools: async ( + localVarQueryParameter?: ListPoolsQueryParams, + options: AxiosRequestConfig = {}, + ): Promise => { + const localVarPath = `/pools`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Return information about blocks minted by a given pool for all epochs (or just for epoch `epoch_no` if provided) + * @summary Stake pool blocks + * @param {string} poolId Pool ID in bech32 format + * @param {PoolBlocksQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + poolBlocks: async ( + poolId: string, + localVarQueryParameter: PoolBlocksQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'poolId' is not null or undefined + assertParamExists('poolBlocks', 'poolId', poolId); + const localVarPath = `/pools/{pool_id}/blocks`.replace(`{${'pool_id'}}`, encodeURIComponent(String(poolId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of delegators of the specified pool + * @summary Stake pool delegators + * @param {string} poolId Pool ID in bech32 format + * @param {PoolDelegatorsQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + poolDelegators: async ( + poolId: string, + localVarQueryParameter: PoolDelegatorsQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'poolId' is not null or undefined + assertParamExists('poolDelegators', 'poolId', poolId); + const localVarPath = `/pools/{pool_id}/delegators`.replace( + `{${'pool_id'}}`, + encodeURIComponent(String(poolId)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns per-epoch information about the specified pool (or just for epoch `epoch_no` if provided) + * @summary Stake pool history + * @param {string} poolId Pool ID in bech32 format + * @param {PoolHistoryQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + poolHistory: async ( + poolId: string, + localVarQueryParameter: PoolHistoryQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'poolId' is not null or undefined + assertParamExists('poolHistory', 'poolId', poolId); + const localVarPath = `/pools/{pool_id}/history`.replace(`{${'pool_id'}}`, encodeURIComponent(String(poolId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns current information about the specified pool + * @summary Stake pool information + * @param {string} poolId Pool ID in bech32 format + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + poolInfo: async (poolId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'poolId' is not null or undefined + assertParamExists('poolInfo', 'poolId', poolId); + const localVarPath = `/pools/{pool_id}/info`.replace(`{${'pool_id'}}`, encodeURIComponent(String(poolId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the metadata declared on-chain by the specified stake pool + * @summary Stake pool metadata + * @param {string} poolId Pool ID in bech32 format + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + poolMetadata: async (poolId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'poolId' is not null or undefined + assertParamExists('poolMetadata', 'poolId', poolId); + const localVarPath = `/pools/{pool_id}/metadata`.replace(`{${'pool_id'}}`, encodeURIComponent(String(poolId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of relays declared on-chain by the specified stake pool + * @summary Stake pool relays + * @param {string} poolId Pool ID in bech32 format + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + poolRelays: async (poolId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'poolId' is not null or undefined + assertParamExists('poolRelays', 'poolId', poolId); + const localVarPath = `/pools/{pool_id}/relays`.replace(`{${'pool_id'}}`, encodeURIComponent(String(poolId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of updates relating to the specified pool + * @summary Stake pool updates + * @param {string} poolId Pool ID in bech32 format + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + poolUpdates: async (poolId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'poolId' is not null or undefined + assertParamExists('poolUpdates', 'poolId', poolId); + const localVarPath = `/pools/{pool_id}/updates`.replace(`{${'pool_id'}}`, encodeURIComponent(String(poolId))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * PoolsApi - functional programming interface * @export */ -export const PoolsApiFp = function (configuration: Configuration) { +export const PoolsApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = PoolsApiAxiosParamCreator(configuration); return { /** @@ -469,129 +452,3 @@ export const PoolsApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * PoolsApi - factory interface -// * @export -// */ -// export const PoolsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = PoolsApiFp(configuration); -// return { -// /** -// * Returns a list of currently registered stake pools -// * @summary List registered stake pools -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// listPools(count?: number | null, cursor?: string | null, options?: any): AxiosPromise { -// return localVarFp.listPools(count, cursor, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Return information about blocks minted by a given pool for all epochs (or just for epoch `epoch_no` if provided) -// * @summary Stake pool blocks -// * @param {string} poolId Pool ID in bech32 format -// * @param {number | null} [epochNo] Epoch number to fetch results for -// * @param {number | null} [count] The max number of results per page -// * @param {PoolBlocksOrderEnum} [order] The order in which the results are sorted (by block absolute slot) -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// poolBlocks( -// poolId: string, -// epochNo?: number | null, -// count?: number | null, -// order?: PoolBlocksOrderEnum, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .poolBlocks(poolId, epochNo, count, order, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of delegators of the specified pool -// * @summary Stake pool delegators -// * @param {string} poolId Pool ID in bech32 format -// * @param {number | null} [count] The max number of results per page -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// poolDelegators( -// poolId: string, -// count?: number | null, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .poolDelegators(poolId, count, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns per-epoch information about the specified pool (or just for epoch `epoch_no` if provided) -// * @summary Stake pool history -// * @param {string} poolId Pool ID in bech32 format -// * @param {number | null} [epochNo] Epoch number to fetch results for -// * @param {number | null} [count] The max number of results per page -// * @param {PoolHistoryOrderEnum} [order] The order in which the results are sorted (by epoch number) -// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// poolHistory( -// poolId: string, -// epochNo?: number | null, -// count?: number | null, -// order?: PoolHistoryOrderEnum, -// cursor?: string | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .poolHistory(poolId, epochNo, count, order, cursor, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Returns current information about the specified pool -// * @summary Stake pool information -// * @param {string} poolId Pool ID in bech32 format -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// poolInfo(poolId: string, options?: any): AxiosPromise { -// return localVarFp.poolInfo(poolId, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns the metadata declared on-chain by the specified stake pool -// * @summary Stake pool metadata -// * @param {string} poolId Pool ID in bech32 format -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// poolMetadata(poolId: string, options?: any): AxiosPromise { -// return localVarFp.poolMetadata(poolId, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of relays declared on-chain by the specified stake pool -// * @summary Stake pool relays -// * @param {string} poolId Pool ID in bech32 format -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// poolRelays(poolId: string, options?: any): AxiosPromise { -// return localVarFp.poolRelays(poolId, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns a list of updates relating to the specified pool -// * @summary Stake pool updates -// * @param {string} poolId Pool ID in bech32 format -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// poolUpdates(poolId: string, options?: any): AxiosPromise { -// return localVarFp.poolUpdates(poolId, options).then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/scripts/helpers.ts b/src/api/scripts/helpers.ts index fa6bc91..72531e5 100644 --- a/src/api/scripts/helpers.ts +++ b/src/api/scripts/helpers.ts @@ -15,54 +15,52 @@ import { TimestampedScript } from '../type'; * ScriptsApi - axios parameter creator * @export */ -export const ScriptsApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns the script corresponding to the specified script hash, if the script has been seen on-chain - * @summary Script by script hash - * @param {string} scriptHash Hex encoded script hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - scriptByHash: async (scriptHash: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'scriptHash' is not null or undefined - assertParamExists('scriptByHash', 'scriptHash', scriptHash); - const localVarPath = `/scripts/{script_hash}`.replace( - `{${'script_hash'}}`, - encodeURIComponent(String(scriptHash)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; +export const ScriptsApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns the script corresponding to the specified script hash, if the script has been seen on-chain + * @summary Script by script hash + * @param {string} scriptHash Hex encoded script hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + scriptByHash: async (scriptHash: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'scriptHash' is not null or undefined + assertParamExists('scriptByHash', 'scriptHash', scriptHash); + const localVarPath = `/scripts/{script_hash}`.replace( + `{${'script_hash'}}`, + encodeURIComponent(String(scriptHash)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * ScriptsApi - functional programming interface * @export */ -export const ScriptsApiFp = function (configuration: Configuration) { +export const ScriptsApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = ScriptsApiAxiosParamCreator(configuration); return { /** @@ -81,23 +79,3 @@ export const ScriptsApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * ScriptsApi - factory interface -// * @export -// */ -// export const ScriptsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = ScriptsApiFp(configuration); -// return { -// /** -// * Returns the script corresponding to the specified script hash, if the script has been seen on-chain -// * @summary Script by script hash -// * @param {string} scriptHash Hex encoded script hash -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// scriptByHash(scriptHash: string, options?: any): AxiosPromise { -// return localVarFp.scriptByHash(scriptHash, options).then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/transactionManager/helpers.ts b/src/api/transactionManager/helpers.ts index 4fcd830..211fd4e 100644 --- a/src/api/transactionManager/helpers.ts +++ b/src/api/transactionManager/helpers.ts @@ -16,166 +16,158 @@ import { TxManagerHistoryQueryParams } from './type'; * TransactionManagerApi - axios parameter creator * @export */ -export const TransactionManagerApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns the history of submitted transactions - * @summary Transactions history - * @param {TxManagerHistoryQueryParams} [localVarQueryParameter] Query parameters. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txManagerHistory: async ( - localVarQueryParameter: TxManagerHistoryQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - const localVarPath = `/txmanager/history`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the most recent state of a transaction - * @summary Transaction state - * @param {string} txHash Hex encoded transaction hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txManagerState: async (txHash: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'txHash' is not null or undefined - assertParamExists('txManagerState', 'txHash', txHash); - const localVarPath = `/txmanager/{tx_hash}/state`.replace( - `{${'tx_hash'}}`, - encodeURIComponent(String(txHash)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [monitored by Maestro](../Dapp%20Platform/Transaction%20Manager). - * @summary Submit transaction - * @param {string | Uint8Array} body CBOR encoded transaction - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txManagerSubmit: async (body: string | Uint8Array, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'body' is not null or undefined - assertParamExists('txManagerSubmit', 'body', body); - const localVarPath = `/txmanager`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - localVarHeaderParameter['Content-Type'] = 'application/cbor'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = typeof body === 'string' ? Buffer.from(body, 'hex') : Buffer.from(body); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [Turbo Submitted and Monitored by Maestro](../Dapp%20Platform/Turbo%20Transaction). - * @summary Turbo submit transaction - * @param {string | Uint8Array} body CBOR encoded transaction - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txManagerTurboSubmit: async ( - body: string | Uint8Array, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'body' is not null or undefined - assertParamExists('txManagerTurboSubmit', 'body', body); - const localVarPath = `/txmanager/turbosubmit`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - localVarHeaderParameter['Content-Type'] = 'application/cbor'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = typeof body === 'string' ? Buffer.from(body, 'hex') : Buffer.from(body); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; +export const TransactionManagerApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns the history of submitted transactions + * @summary Transactions history + * @param {TxManagerHistoryQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txManagerHistory: async ( + localVarQueryParameter: TxManagerHistoryQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + const localVarPath = `/txmanager/history`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the most recent state of a transaction + * @summary Transaction state + * @param {string} txHash Hex encoded transaction hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txManagerState: async (txHash: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'txHash' is not null or undefined + assertParamExists('txManagerState', 'txHash', txHash); + const localVarPath = `/txmanager/{tx_hash}/state`.replace(`{${'tx_hash'}}`, encodeURIComponent(String(txHash))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [monitored by Maestro](../Dapp%20Platform/Transaction%20Manager). + * @summary Submit transaction + * @param {string | Uint8Array} body CBOR encoded transaction + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txManagerSubmit: async (body: string | Uint8Array, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'body' is not null or undefined + assertParamExists('txManagerSubmit', 'body', body); + const localVarPath = `/txmanager`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + localVarHeaderParameter['Content-Type'] = 'application/cbor'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = typeof body === 'string' ? Buffer.from(body, 'hex') : Buffer.from(body); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [Turbo Submitted and Monitored by Maestro](../Dapp%20Platform/Turbo%20Transaction). + * @summary Turbo submit transaction + * @param {string | Uint8Array} body CBOR encoded transaction + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txManagerTurboSubmit: async (body: string | Uint8Array, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'body' is not null or undefined + assertParamExists('txManagerTurboSubmit', 'body', body); + const localVarPath = `/txmanager/turbosubmit`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + localVarHeaderParameter['Content-Type'] = 'application/cbor'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = typeof body === 'string' ? Buffer.from(body, 'hex') : Buffer.from(body); + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * TransactionManagerApi - functional programming interface * @export */ -export const TransactionManagerApiFp = function (configuration: Configuration) { +export const TransactionManagerApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = TransactionManagerApiAxiosParamCreator(configuration); return { /** @@ -236,58 +228,3 @@ export const TransactionManagerApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * TransactionManagerApi - factory interface -// * @export -// */ -// export const TransactionManagerApiFactory = function ( -// configuration: Configuration, -// basePath?: string, -// axios?: AxiosInstance, -// ) { -// const localVarFp = TransactionManagerApiFp(configuration); -// return { -// /** -// * Returns the history of submitted transactions -// * @summary Transactions history -// * @param {number} [count] The max number of results per pagination page -// * @param {number} [page] Pagination page number to show results for -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txManagerHistory(count?: number, page?: number, options?: any): AxiosPromise> { -// return localVarFp.txManagerHistory(count, page, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns the most recent state of a transaction -// * @summary Transaction state -// * @param {string} txHash Hex encoded transaction hash -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txManagerState(txHash: string, options?: any): AxiosPromise { -// return localVarFp.txManagerState(txHash, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [monitored by Maestro](../Dapp%20Platform/Transaction%20Manager). -// * @summary Submit transaction -// * @param {string} body CBOR encoded transaction -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txManagerSubmit(body: string, options?: any): AxiosPromise { -// return localVarFp.txManagerSubmit(body, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [Turbo Submitted and Monitored by Maestro](../Dapp%20Platform/Turbo%20Transaction). -// * @summary Turbo submit transaction -// * @param {string} body CBOR encoded transaction -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txManagerTurboSubmit(body: string, options?: any): AxiosPromise { -// return localVarFp.txManagerTurboSubmit(body, options).then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/transactions/helpers.ts b/src/api/transactions/helpers.ts index 08eb7a0..b80863a 100644 --- a/src/api/transactions/helpers.ts +++ b/src/api/transactions/helpers.ts @@ -24,220 +24,215 @@ import { TxoByTxoRefQueryParams, TxosByTxoRefsQueryParams } from './type'; * TransactionsApi - axios parameter creator * @export */ -export const TransactionsApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Returns the address which was specified in the given transaction output. Note that if the transaction is invalid this will only return a result for the collateral return output, should one be present in the transaction. If the transaction is valid it will not return a result for the collateral return output. - * @summary Address by transaction output reference - * @param {string} txHash Transaction Hash - * @param {number} index Output Index - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - addressByTxo: async (txHash: string, index: number, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'txHash' is not null or undefined - assertParamExists('addressByTxo', 'txHash', txHash); - // verify required parameter 'index' is not null or undefined - assertParamExists('addressByTxo', 'index', index); - const localVarPath = `/transactions/{tx_hash}/outputs/{index}/address` - .replace(`{${'tx_hash'}}`, encodeURIComponent(String(txHash))) - .replace(`{${'index'}}`, encodeURIComponent(String(index))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; +export const TransactionsApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Returns the address which was specified in the given transaction output. Note that if the transaction is invalid this will only return a result for the collateral return output, should one be present in the transaction. If the transaction is valid it will not return a result for the collateral return output. + * @summary Address by transaction output reference + * @param {string} txHash Transaction Hash + * @param {number} index Output Index + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addressByTxo: async (txHash: string, index: number, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'txHash' is not null or undefined + assertParamExists('addressByTxo', 'txHash', txHash); + // verify required parameter 'index' is not null or undefined + assertParamExists('addressByTxo', 'index', index); + const localVarPath = `/transactions/{tx_hash}/outputs/{index}/address` + .replace(`{${'tx_hash'}}`, encodeURIComponent(String(txHash))) + .replace(`{${'index'}}`, encodeURIComponent(String(index))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns hex-encoded CBOR bytes of a transaction - * @summary CBOR bytes of a transaction - * @param {string} txHash Transaction Hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txCborByTxHash: async (txHash: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'txHash' is not null or undefined - assertParamExists('txCborByTxHash', 'txHash', txHash); - const localVarPath = `/transactions/{tx_hash}/cbor`.replace( - `{${'tx_hash'}}`, - encodeURIComponent(String(txHash)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns hex-encoded CBOR bytes of a transaction + * @summary CBOR bytes of a transaction + * @param {string} txHash Transaction Hash + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txCborByTxHash: async (txHash: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'txHash' is not null or undefined + assertParamExists('txCborByTxHash', 'txHash', txHash); + const localVarPath = `/transactions/{tx_hash}/cbor`.replace( + `{${'tx_hash'}}`, + encodeURIComponent(String(txHash)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns detailed information about a transaction - * @summary Transaction details - * @param {string} txHash Transaction hash in hex - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txInfo: async (txHash: string, options: AxiosRequestConfig = {}): Promise => { - // verify required parameter 'txHash' is not null or undefined - assertParamExists('txInfo', 'txHash', txHash); - const localVarPath = `/transactions/{tx_hash}`.replace( - `{${'tx_hash'}}`, - encodeURIComponent(String(txHash)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns detailed information about a transaction + * @summary Transaction details + * @param {string} txHash Transaction hash in hex + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txInfo: async (txHash: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'txHash' is not null or undefined + assertParamExists('txInfo', 'txHash', txHash); + const localVarPath = `/transactions/{tx_hash}`.replace(`{${'tx_hash'}}`, encodeURIComponent(String(txHash))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the specified transaction output. - * @summary Transaction output by output reference - * @param {string} txHash Transaction Hash - * @param {number} index Output Index - * @param {TxoByTxoRefQueryParams} [localVarQueryParameter] Query Parameters - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txoByTxoRef: async ( - txHash: string, - index: number, - localVarQueryParameter: TxoByTxoRefQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'txHash' is not null or undefined - assertParamExists('txoByTxoRef', 'txHash', txHash); - // verify required parameter 'index' is not null or undefined - assertParamExists('txoByTxoRef', 'index', index); - const localVarPath = `/transactions/{tx_hash}/outputs/{index}/txo` - .replace(`{${'tx_hash'}}`, encodeURIComponent(String(txHash))) - .replace(`{${'index'}}`, encodeURIComponent(String(index))); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the specified transaction output. + * @summary Transaction output by output reference + * @param {string} txHash Transaction Hash + * @param {number} index Output Index + * @param {TxoByTxoRefQueryParams} [localVarQueryParameter] Query Parameters + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txoByTxoRef: async ( + txHash: string, + index: number, + localVarQueryParameter: TxoByTxoRefQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'txHash' is not null or undefined + assertParamExists('txoByTxoRef', 'txHash', txHash); + // verify required parameter 'index' is not null or undefined + assertParamExists('txoByTxoRef', 'index', index); + const localVarPath = `/transactions/{tx_hash}/outputs/{index}/txo` + .replace(`{${'tx_hash'}}`, encodeURIComponent(String(txHash))) + .replace(`{${'index'}}`, encodeURIComponent(String(index))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns the specified transaction outputs - * @summary Transaction outputs by output references - * @param {Array} requestBody - * @param {TxosByTxoRefsQueryParams} [localVarQueryParameter] Query Parameters - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txosByTxoRefs: async ( - requestBody: Array, - localVarQueryParameter: TxosByTxoRefsQueryParams = {}, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'requestBody' is not null or undefined - assertParamExists('txosByTxoRefs', 'requestBody', requestBody); - const localVarPath = `/transactions/outputs`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the specified transaction outputs + * @summary Transaction outputs by output references + * @param {Array} requestBody + * @param {TxosByTxoRefsQueryParams} [localVarQueryParameter] Query Parameters + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + txosByTxoRefs: async ( + requestBody: Array, + localVarQueryParameter: TxosByTxoRefsQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('txosByTxoRefs', 'requestBody', requestBody); + const localVarPath = `/transactions/outputs`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['Content-Type'] = 'application/json'; - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - ...HEADER_AMOUNTS_AS_STRING, - }; - localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, + }; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * TransactionsApi - functional programming interface * @export */ -export const TransactionsApiFp = function (configuration: Configuration) { +export const TransactionsApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = TransactionsApiAxiosParamCreator(configuration); return { /** @@ -320,84 +315,3 @@ export const TransactionsApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * TransactionsApi - factory interface -// * @export -// */ -// export const TransactionsApiFactory = function ( -// configuration: Configuration, -// basePath?: string, -// axios?: AxiosInstance, -// ) { -// const localVarFp = TransactionsApiFp(configuration); -// return { -// /** -// * Returns the address which was specified in the given transaction output. Note that if the transaction is invalid this will only return a result for the collateral return output, should one be present in the transaction. If the transaction is valid it will not return a result for the collateral return output. -// * @summary Address by transaction output reference -// * @param {string} txHash Transaction Hash -// * @param {number} index Output Index -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// addressByTxo(txHash: string, index: number, options?: any): AxiosPromise { -// return localVarFp.addressByTxo(txHash, index, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns hex-encoded CBOR bytes of a transaction -// * @summary CBOR bytes of a transaction -// * @param {string} txHash Transaction Hash -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txCborByTxHash(txHash: string, options?: any): AxiosPromise { -// return localVarFp.txCborByTxHash(txHash, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns detailed information about a transaction -// * @summary Transaction details -// * @param {string} txHash Transaction hash in hex -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txInfo(txHash: string, options?: any): AxiosPromise { -// return localVarFp.txInfo(txHash, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns the specified transaction output. -// * @summary Transaction output by output reference -// * @param {string} txHash Transaction Hash -// * @param {number} index Output Index -// * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txoByTxoRef( -// txHash: string, -// index: number, -// withCbor?: boolean | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp.txoByTxoRef(txHash, index, withCbor, options).then((request) => request(axios, basePath)); -// }, -// /** -// * Returns the specified transaction outputs -// * @summary Transaction outputs by output references -// * @param {Array} requestBody -// * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes -// * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// txosByTxoRefs( -// requestBody: Array, -// resolveDatums?: boolean | null, -// withCbor?: boolean | null, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .txosByTxoRefs(requestBody, resolveDatums, withCbor, options) -// .then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/api/type.ts b/src/api/type.ts index 83ca511..16e0eba 100644 --- a/src/api/type.ts +++ b/src/api/type.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-use-before-define */ /* eslint-disable @typescript-eslint/no-empty-interface */ /** * Type of staking-related action diff --git a/src/api/vesting/helpers.ts b/src/api/vesting/helpers.ts index 8e4c04f..3f11b9c 100644 --- a/src/api/vesting/helpers.ts +++ b/src/api/vesting/helpers.ts @@ -16,147 +16,145 @@ import { ContractsVestingLockPostRequest, ContractsVestingLockPost200Response, V * VestingApi - axios parameter creator * @export */ -export const VestingApiAxiosParamCreator = function (configuration: Configuration) { - return { - /** - * Collect assets from the vesting contract - * @summary Collect assets - * @param {string} beneficiary Beneficiary\'s bech32 address - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - contractsVestingCollectBeneficiaryPost: async ( - beneficiary: string, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'beneficiary' is not null or undefined - assertParamExists('contractsVestingCollectBeneficiaryPost', 'beneficiary', beneficiary); - const localVarPath = `/contracts/vesting/collect/{beneficiary}`.replace( - `{${'beneficiary'}}`, - encodeURIComponent(String(beneficiary)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions: AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Lock assets into the vesting contract - * @summary Lock assets - * @param {ContractsVestingLockPostRequest} contractsVestingLockPostRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - contractsVestingLockPost: async ( - contractsVestingLockPostRequest: ContractsVestingLockPostRequest, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'contractsVestingLockPostRequest' is not null or undefined - assertParamExists( - 'contractsVestingLockPost', - 'contractsVestingLockPostRequest', - contractsVestingLockPostRequest, - ); - const localVarPath = `/contracts/vesting/lock`; - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - localVarRequestOptions.data = serializeDataIfNeeded( - contractsVestingLockPostRequest, - localVarRequestOptions, - configuration, - ); - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Detailed list of vesting assets at a beneficiary address - * @summary State of vesting assets - * @param {string} beneficiary Beneficiary bech32 address - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - contractsVestingStateBeneficiaryGet: async ( - beneficiary: string, - options: AxiosRequestConfig = {}, - ): Promise => { - // verify required parameter 'beneficiary' is not null or undefined - assertParamExists('contractsVestingStateBeneficiaryGet', 'beneficiary', beneficiary); - const localVarPath = `/contracts/vesting/state/{beneficiary}`.replace( - `{${'beneficiary'}}`, - encodeURIComponent(String(beneficiary)), - ); - // use dummy base URL string because the URL constructor only accepts absolute URLs. - const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); - const { baseOptions } = configuration; - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication api-key required - setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - - setSearchParams(localVarUrlObj, localVarQueryParameter); - const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = { - ...localVarHeaderParameter, - ...headersFromBaseOptions, - ...options.headers, - }; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - }; -}; +export const VestingApiAxiosParamCreator = (configuration: Configuration) => ({ + /** + * Collect assets from the vesting contract + * @summary Collect assets + * @param {string} beneficiary Beneficiary\'s bech32 address + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + contractsVestingCollectBeneficiaryPost: async ( + beneficiary: string, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'beneficiary' is not null or undefined + assertParamExists('contractsVestingCollectBeneficiaryPost', 'beneficiary', beneficiary); + const localVarPath = `/contracts/vesting/collect/{beneficiary}`.replace( + `{${'beneficiary'}}`, + encodeURIComponent(String(beneficiary)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions: AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Lock assets into the vesting contract + * @summary Lock assets + * @param {ContractsVestingLockPostRequest} contractsVestingLockPostRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + contractsVestingLockPost: async ( + contractsVestingLockPostRequest: ContractsVestingLockPostRequest, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'contractsVestingLockPostRequest' is not null or undefined + assertParamExists( + 'contractsVestingLockPost', + 'contractsVestingLockPostRequest', + contractsVestingLockPostRequest, + ); + const localVarPath = `/contracts/vesting/lock`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + contractsVestingLockPostRequest, + localVarRequestOptions, + configuration, + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Detailed list of vesting assets at a beneficiary address + * @summary State of vesting assets + * @param {string} beneficiary Beneficiary bech32 address + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + contractsVestingStateBeneficiaryGet: async ( + beneficiary: string, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'beneficiary' is not null or undefined + assertParamExists('contractsVestingStateBeneficiaryGet', 'beneficiary', beneficiary); + const localVarPath = `/contracts/vesting/state/{beneficiary}`.replace( + `{${'beneficiary'}}`, + encodeURIComponent(String(beneficiary)), + ); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as Record; + const localVarQueryParameter = {} as Record; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, +}); /** * VestingApi - functional programming interface * @export */ -export const VestingApiFp = function (configuration: Configuration) { +export const VestingApiFp = (configuration: Configuration) => { const localVarAxiosParamCreator = VestingApiAxiosParamCreator(configuration); return { /** @@ -212,55 +210,3 @@ export const VestingApiFp = function (configuration: Configuration) { }, }; }; - -// /** -// * VestingApi - factory interface -// * @export -// */ -// export const VestingApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { -// const localVarFp = VestingApiFp(configuration); -// return { -// /** -// * Collect assets from the vesting contract -// * @summary Collect assets -// * @param {string} beneficiary Beneficiary\'s bech32 address -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// contractsVestingCollectBeneficiaryPost( -// beneficiary: string, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .contractsVestingCollectBeneficiaryPost(beneficiary, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Lock assets into the vesting contract -// * @summary Lock assets -// * @param {ContractsVestingLockPostRequest} contractsVestingLockPostRequest -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// contractsVestingLockPost( -// contractsVestingLockPostRequest: ContractsVestingLockPostRequest, -// options?: any, -// ): AxiosPromise { -// return localVarFp -// .contractsVestingLockPost(contractsVestingLockPostRequest, options) -// .then((request) => request(axios, basePath)); -// }, -// /** -// * Detailed list of vesting assets at a beneficiary address -// * @summary State of vesting assets -// * @param {string} beneficiary Beneficiary bech32 address -// * @param {*} [options] Override http request option. -// * @throws {RequiredError} -// */ -// contractsVestingStateBeneficiaryGet(beneficiary: string, options?: any): AxiosPromise { -// return localVarFp -// .contractsVestingStateBeneficiaryGet(beneficiary, options) -// .then((request) => request(axios, basePath)); -// }, -// }; -// }; diff --git a/src/base.ts b/src/base.ts index ebe47d6..e13f51f 100644 --- a/src/base.ts +++ b/src/base.ts @@ -1,5 +1,5 @@ -import type { AxiosInstance, AxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +/* eslint-disable max-classes-per-file */ +import type { AxiosRequestConfig } from 'axios'; import type { Configuration } from './configuration'; /** diff --git a/src/common.ts b/src/common.ts index 872f25d..16a2c07 100644 --- a/src/common.ts +++ b/src/common.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ import type { AxiosResponse } from 'axios'; import type { Configuration } from './configuration'; import type { RequestArgs } from './base'; @@ -23,7 +24,7 @@ export const HEADER_AMOUNTS_AS_STRING = { * @throws {RequiredError} * @export */ -export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { +export const assertParamExists = (functionName: string, paramName: string, paramValue: unknown) => { if (paramValue === null || paramValue === undefined) { throw new RequiredError( paramName, @@ -36,8 +37,12 @@ export const assertParamExists = function (functionName: string, paramName: stri * * @export */ -export const setApiKeyToObject = function (object: any, keyParamName: string, configuration: Configuration) { - object[keyParamName] = configuration.apiKey; +export const setApiKeyToObject = ( + targetObject: Record, + keyParamName: string, + configuration: Configuration, +) => { + targetObject[keyParamName] = configuration.apiKey; }; function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ''): void { @@ -65,7 +70,7 @@ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: an * * @export */ -export const setSearchParams = function (url: URL, ...objects: any[]) { +export const setSearchParams = (url: URL, ...objects: any[]) => { const searchParams = new URLSearchParams(url.search); setFlattenedQueryParams(searchParams, objects); url.search = searchParams.toString(); @@ -75,7 +80,7 @@ export const setSearchParams = function (url: URL, ...objects: any[]) { * * @export */ -export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { +export const serializeDataIfNeeded = (value: any, requestOptions: any, configuration?: Configuration) => { const nonString = typeof value !== 'string'; const needsSerialization = nonString && configuration && configuration.isJsonMime @@ -88,17 +93,16 @@ export const serializeDataIfNeeded = function (value: any, requestOptions: any, * * @export */ -export const toPathString = function (url: URL) { - return url.pathname + url.search + url.hash; -}; +export const toPathString = (url: URL) => url.pathname + url.search + url.hash; /** * * @export */ -export const createRequestFunction = function (axiosArgs: RequestArgs, configuration: Configuration) { - return >() => { +export const createRequestFunction = + (axiosArgs: RequestArgs, configuration: Configuration) => + async () => { const axiosRequestArgs = { ...axiosArgs.options, url: configuration.baseUrl + axiosArgs.url }; - return configuration.axiosInstance.request(axiosRequestArgs); + const response = await configuration.axiosInstance.request>(axiosRequestArgs); + return response.data; }; -}; diff --git a/src/configuration.ts b/src/configuration.ts index 58e2f24..51405c9 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -53,6 +53,7 @@ export class Configuration { * @return True if the given MIME is JSON, false otherwise. */ public isJsonMime(mime: string): boolean { + // eslint-disable-next-line prefer-regex-literals, no-control-regex const jsonMime: RegExp = new RegExp('^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); }